﻿using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

namespace OplugAbpProject.Migrations
{
    public partial class UpdateCategory : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterColumn<int>(
                name: "TenantId",
                table: "Category",
                nullable: true,
                oldClrType: typeof(int));

            migrationBuilder.CreateTable(
                name: "DMRActn",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    Company = table.Column<string>(maxLength: 8, nullable: true),
                    DMRNum = table.Column<int>(nullable: false),
                    ActionNum = table.Column<int>(nullable: false),
                    ActionDate = table.Column<DateTime>(type: "date", nullable: true),
                    ActionType = table.Column<string>(maxLength: 2, nullable: false),
                    Quantity = table.Column<decimal>(nullable: false),
                    DestinationType = table.Column<string>(maxLength: 2, nullable: false),
                    WarehouseCode = table.Column<string>(maxLength: 8, nullable: false),
                    BinNum = table.Column<string>(maxLength: 10, nullable: false),
                    JobNum = table.Column<string>(maxLength: 14, nullable: false),
                    AssemblySeq = table.Column<int>(nullable: false),
                    DMRSeqNum = table.Column<int>(nullable: false),
                    UnitCredit = table.Column<decimal>(nullable: false),
                    DocUnitCredit = table.Column<decimal>(nullable: false),
                    CreditUM = table.Column<string>(maxLength: 6, nullable: false),
                    DebitMemoNum = table.Column<string>(maxLength: 20, nullable: false),
                    DebitMemoLine = table.Column<int>(nullable: false),
                    VendRMANum = table.Column<string>(maxLength: 30, nullable: false),
                    ActionUserID = table.Column<string>(maxLength: 75, nullable: false),
                    SysDate = table.Column<DateTime>(type: "date", nullable: true),
                    SysTime = table.Column<int>(nullable: false),
                    CommentText = table.Column<string>(nullable: false),
                    ReasonCode = table.Column<string>(maxLength: 8, nullable: false),
                    CurrencyCode = table.Column<string>(maxLength: 4, nullable: false),
                    ExchangeRate = table.Column<decimal>(nullable: false),
                    LockRate = table.Column<bool>(nullable: false),
                    FldWarehouseCode = table.Column<string>(maxLength: 8, nullable: false),
                    FldBinNum = table.Column<string>(maxLength: 10, nullable: false),
                    LegalNumber = table.Column<string>(maxLength: 30, nullable: false),
                    Rpt1UnitCredit = table.Column<decimal>(nullable: false),
                    Rpt2UnitCredit = table.Column<decimal>(nullable: false),
                    Rpt3UnitCredit = table.Column<decimal>(nullable: false),
                    RateGrpCode = table.Column<string>(maxLength: 12, nullable: false),
                    Resolution = table.Column<string>(maxLength: 8, nullable: false),
                    ReturnToSupplier = table.Column<bool>(nullable: false),
                    PackSlip = table.Column<string>(maxLength: 20, nullable: false),
                    PackLine = table.Column<int>(nullable: false),
                    DisableRejection = table.Column<bool>(nullable: false),
                    DisableRejectionChar = table.Column<string>(maxLength: 20, nullable: false),
                    RefInvoiceNum = table.Column<string>(maxLength: 20, nullable: false),
                    IssuedComplete = table.Column<bool>(nullable: false),
                    TenantId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_DMRActn", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "DMRCorAct",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    Company = table.Column<string>(maxLength: 8, nullable: true),
                    Description = table.Column<string>(maxLength: 30, nullable: false),
                    CommentText = table.Column<string>(nullable: false),
                    NonConfNum = table.Column<int>(nullable: false),
                    AsigndTo = table.Column<string>(maxLength: 75, nullable: false),
                    AuditBy = table.Column<string>(maxLength: 75, nullable: false),
                    AuditCmts = table.Column<string>(nullable: false),
                    CauseInv = table.Column<string>(nullable: false),
                    Dept = table.Column<string>(maxLength: 8, nullable: false),
                    DateOpen = table.Column<DateTime>(type: "date", nullable: true),
                    DuDate = table.Column<DateTime>(type: "date", nullable: true),
                    AuditDt = table.Column<DateTime>(type: "date", nullable: true),
                    ActionComp = table.Column<DateTime>(type: "date", nullable: true),
                    DMRNum = table.Column<int>(nullable: false),
                    ActionID = table.Column<int>(nullable: false),
                    CauseReasonCode = table.Column<string>(maxLength: 8, nullable: false),
                    CorrectiveActionReasonCode = table.Column<string>(maxLength: 8, nullable: false),
                    VendorNum = table.Column<int>(nullable: false),
                    ConNum = table.Column<int>(nullable: false),
                    TenantId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_DMRCorAct", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "DMRHead",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    Company = table.Column<string>(maxLength: 8, nullable: true),
                    DMRNum = table.Column<int>(nullable: false),
                    OpenDMR = table.Column<bool>(nullable: false),
                    VendorNum = table.Column<int>(nullable: false),
                    PurPoint = table.Column<string>(maxLength: 4, nullable: false),
                    ConNum = table.Column<int>(nullable: false),
                    CommentText = table.Column<string>(nullable: false),
                    TotDiscrepantQty = table.Column<decimal>(nullable: false),
                    TotRejectedQty = table.Column<decimal>(nullable: false),
                    TotAcceptedQty = table.Column<decimal>(nullable: false),
                    AvgMtlUnitCost = table.Column<decimal>(nullable: false),
                    AvgLbrUnitCost = table.Column<decimal>(nullable: false),
                    AvgBurUnitCost = table.Column<decimal>(nullable: false),
                    AvgSubUnitCost = table.Column<decimal>(nullable: false),
                    AvgMtlBurUnitCost = table.Column<decimal>(nullable: false),
                    PartNum = table.Column<string>(maxLength: 50, nullable: false),
                    PartDescription = table.Column<string>(nullable: false),
                    DimCode = table.Column<string>(maxLength: 6, nullable: false),
                    LotNum = table.Column<string>(maxLength: 30, nullable: false),
                    IUM = table.Column<string>(maxLength: 6, nullable: false),
                    CheckOff1 = table.Column<bool>(nullable: false),
                    CheckOff2 = table.Column<bool>(nullable: false),
                    CheckOff3 = table.Column<bool>(nullable: false),
                    CheckOff4 = table.Column<bool>(nullable: false),
                    CheckOff5 = table.Column<bool>(nullable: false),
                    JobNum = table.Column<string>(maxLength: 14, nullable: false),
                    AssemblySeq = table.Column<int>(nullable: false),
                    MtlSeq = table.Column<int>(nullable: false),
                    OprSeq = table.Column<int>(nullable: false),
                    ResourceID = table.Column<string>(maxLength: 12, nullable: false),
                    WarehouseCode = table.Column<string>(maxLength: 8, nullable: false),
                    BinNum = table.Column<string>(maxLength: 10, nullable: false),
                    RevisionNum = table.Column<string>(maxLength: 12, nullable: false),
                    MaterialMtlCost = table.Column<decimal>(nullable: false),
                    MaterialLabCost = table.Column<decimal>(nullable: false),
                    MaterialSubCost = table.Column<decimal>(nullable: false),
                    MaterialBurCost = table.Column<decimal>(nullable: false),
                    ReqDMR = table.Column<bool>(nullable: false),
                    VendRMANum = table.Column<string>(maxLength: 30, nullable: false),
                    TranDocTypeID = table.Column<string>(maxLength: 12, nullable: false),
                    LegalNumber = table.Column<string>(maxLength: 30, nullable: false),
                    Plant = table.Column<string>(maxLength: 8, nullable: false),
                    PONum = table.Column<int>(nullable: false),
                    TenantId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_DMRHead", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "JobOpDtl",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    Company = table.Column<string>(maxLength: 8, nullable: false),
                    JobNum = table.Column<string>(maxLength: 14, nullable: false),
                    AssemblySeq = table.Column<int>(nullable: false),
                    OprSeq = table.Column<int>(nullable: false),
                    OpDtlSeq = table.Column<int>(nullable: false),
                    SetupOrProd = table.Column<string>(maxLength: 2, nullable: false),
                    CapabilityID = table.Column<string>(maxLength: 20, nullable: false),
                    ResourceGrpID = table.Column<string>(maxLength: 8, nullable: false),
                    ResourceID = table.Column<string>(maxLength: 12, nullable: false),
                    ConcurrentCapacity = table.Column<decimal>(nullable: false),
                    DailyProdRate = table.Column<decimal>(nullable: false),
                    NumResources = table.Column<int>(nullable: false),
                    EstSetHours = table.Column<decimal>(nullable: false),
                    EstProdHours = table.Column<decimal>(nullable: false),
                    ProdStandard = table.Column<decimal>(nullable: false),
                    StdFormat = table.Column<string>(maxLength: 2, nullable: false),
                    StdBasis = table.Column<string>(maxLength: 2, nullable: false),
                    OpsPerPart = table.Column<int>(nullable: false),
                    ProdLabRate = table.Column<decimal>(nullable: false),
                    SetupLabRate = table.Column<decimal>(nullable: false),
                    ProdBurRate = table.Column<decimal>(nullable: false),
                    SetupBurRate = table.Column<decimal>(nullable: false),
                    ProdComplete = table.Column<bool>(nullable: false),
                    SetupComplete = table.Column<bool>(nullable: false),
                    ActProdHours = table.Column<decimal>(nullable: false),
                    ActProdRwkHours = table.Column<decimal>(nullable: false),
                    ActSetupHours = table.Column<decimal>(nullable: false),
                    ActSetupRwkHours = table.Column<decimal>(nullable: false),
                    SetupPctComplete = table.Column<int>(nullable: false),
                    ActBurCost = table.Column<decimal>(nullable: false),
                    ActLabCost = table.Column<decimal>(nullable: false),
                    ReworkBurCost = table.Column<decimal>(nullable: false),
                    ReworkLabCost = table.Column<decimal>(nullable: false),
                    ResourceLock = table.Column<bool>(nullable: false),
                    SysCreateDate = table.Column<DateTime>(type: "date", nullable: true),
                    SysCreateTime = table.Column<int>(nullable: false),
                    OpDtlDesc = table.Column<string>(maxLength: 30, nullable: false),
                    EstSetHoursPerMch = table.Column<decimal>(nullable: false),
                    OverrideRates = table.Column<bool>(nullable: false),
                    ProdCrewSize = table.Column<decimal>(nullable: false),
                    SetUpCrewSize = table.Column<decimal>(nullable: false),
                    RemovedFromPlan = table.Column<bool>(nullable: false),
                    IsPrimaryProd = table.Column<bool>(nullable: false),
                    IsPrimarySetup = table.Column<bool>(nullable: false),
                    AutoSystemAdded = table.Column<bool>(nullable: false),
                    MobileAllocatedResource = table.Column<bool>(nullable: false),
                    TenantId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_JobOpDtl", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "JobOper",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    Company = table.Column<string>(maxLength: 8, nullable: false),
                    JobComplete = table.Column<bool>(nullable: false),
                    OpComplete = table.Column<bool>(nullable: false),
                    JobNum = table.Column<string>(maxLength: 14, nullable: false),
                    AssemblySeq = table.Column<int>(nullable: false),
                    OprSeq = table.Column<int>(nullable: false),
                    OpCode = table.Column<string>(maxLength: 8, nullable: false),
                    OpStdID = table.Column<string>(maxLength: 5, nullable: false),
                    EstSetHours = table.Column<decimal>(nullable: false),
                    EstProdHours = table.Column<decimal>(nullable: false),
                    ProdStandard = table.Column<decimal>(nullable: false),
                    StdFormat = table.Column<string>(maxLength: 2, nullable: false),
                    StdBasis = table.Column<string>(maxLength: 2, nullable: false),
                    OpsPerPart = table.Column<int>(nullable: false),
                    QtyPer = table.Column<decimal>(nullable: false),
                    QueStartDate = table.Column<DateTime>(type: "date", nullable: true),
                    QueStartHour = table.Column<decimal>(nullable: false),
                    StartDate = table.Column<DateTime>(type: "date", nullable: true),
                    StartHour = table.Column<decimal>(nullable: false),
                    DueDate = table.Column<DateTime>(type: "date", nullable: true),
                    DueHour = table.Column<decimal>(nullable: false),
                    MoveDueDate = table.Column<DateTime>(type: "date", nullable: true),
                    MoveDueHour = table.Column<decimal>(nullable: false),
                    ProdLabRate = table.Column<decimal>(nullable: false),
                    SetupLabRate = table.Column<decimal>(nullable: false),
                    ProdBurRate = table.Column<decimal>(nullable: false),
                    SetupBurRate = table.Column<decimal>(nullable: false),
                    AddedOper = table.Column<bool>(nullable: false),
                    Machines = table.Column<int>(nullable: false),
                    SetUpCrewSize = table.Column<decimal>(nullable: false),
                    ProdCrewSize = table.Column<decimal>(nullable: false),
                    ProdComplete = table.Column<bool>(nullable: false),
                    SetupComplete = table.Column<bool>(nullable: false),
                    ActProdHours = table.Column<decimal>(nullable: false),
                    ActProdRwkHours = table.Column<decimal>(nullable: false),
                    ActSetupHours = table.Column<decimal>(nullable: false),
                    ActSetupRwkHours = table.Column<decimal>(nullable: false),
                    QtyCompleted = table.Column<decimal>(nullable: false),
                    SetupPctComplete = table.Column<int>(nullable: false),
                    EstScrap = table.Column<decimal>(nullable: false),
                    EstScrapType = table.Column<string>(maxLength: 1, nullable: false),
                    SubContract = table.Column<bool>(nullable: false),
                    IUM = table.Column<string>(maxLength: 6, nullable: false),
                    EstUnitCost = table.Column<decimal>(nullable: false),
                    DaysOut = table.Column<decimal>(nullable: false),
                    PartNum = table.Column<string>(maxLength: 50, nullable: false),
                    Description = table.Column<string>(nullable: false),
                    VendorNum = table.Column<int>(nullable: false),
                    PurPoint = table.Column<string>(maxLength: 4, nullable: false),
                    CommentText = table.Column<string>(nullable: false),
                    SchedRelation = table.Column<string>(maxLength: 4, nullable: false),
                    RunQty = table.Column<decimal>(nullable: false),
                    WIName = table.Column<string>(maxLength: 75, nullable: false),
                    WIMachines = table.Column<int>(nullable: false),
                    WIQueStartDate = table.Column<DateTime>(type: "date", nullable: true),
                    WIQueStartHour = table.Column<decimal>(nullable: false),
                    WIStartDate = table.Column<DateTime>(type: "date", nullable: true),
                    WIStartHour = table.Column<decimal>(nullable: false),
                    WIDueDate = table.Column<DateTime>(type: "date", nullable: true),
                    WIDueHour = table.Column<decimal>(nullable: false),
                    WIMoveDueDate = table.Column<DateTime>(type: "date", nullable: true),
                    WIMoveDueHour = table.Column<decimal>(nullable: false),
                    WIHoursPerMachine = table.Column<decimal>(nullable: false),
                    WILoadDate = table.Column<DateTime>(type: "date", nullable: true),
                    WILoadHour = table.Column<decimal>(nullable: false),
                    ActBurCost = table.Column<decimal>(nullable: false),
                    ActLabCost = table.Column<decimal>(nullable: false),
                    ReworkBurCost = table.Column<decimal>(nullable: false),
                    ReworkLabCost = table.Column<decimal>(nullable: false),
                    MiscAmt = table.Column<decimal>(nullable: false),
                    HoursPerMachine = table.Column<decimal>(nullable: false),
                    LoadDate = table.Column<DateTime>(type: "date", nullable: true),
                    LoadHour = table.Column<decimal>(nullable: false),
                    ReloadNum = table.Column<int>(nullable: false),
                    SndAlrtCmpl = table.Column<bool>(nullable: false),
                    RcvInspectionReq = table.Column<bool>(nullable: false),
                    JobEngineered = table.Column<bool>(nullable: false),
                    EstSetHoursPerMch = table.Column<decimal>(nullable: false),
                    RevisionNum = table.Column<string>(maxLength: 12, nullable: false),
                    AutoReceiptDate = table.Column<string>(maxLength: 8, nullable: false),
                    LastLaborDate = table.Column<DateTime>(type: "date", nullable: true),
                    CallNum = table.Column<int>(nullable: false),
                    CallLine = table.Column<int>(nullable: false),
                    LaborRate = table.Column<decimal>(nullable: false),
                    BillableLaborRate = table.Column<decimal>(nullable: false),
                    DocLaborRate = table.Column<decimal>(nullable: false),
                    DocBillableLaborRate = table.Column<decimal>(nullable: false),
                    Billable = table.Column<bool>(nullable: false),
                    UnitPrice = table.Column<decimal>(nullable: false),
                    BillableUnitPrice = table.Column<decimal>(nullable: false),
                    DocBillableUnitPrice = table.Column<decimal>(nullable: false),
                    DocUnitPrice = table.Column<decimal>(nullable: false),
                    LaborEntryMethod = table.Column<string>(maxLength: 2, nullable: false),
                    PricePerCode = table.Column<string>(maxLength: 2, nullable: false),
                    FAQty = table.Column<decimal>(nullable: false),
                    QtyStagedToDate = table.Column<decimal>(nullable: false),
                    RFQNeeded = table.Column<bool>(nullable: false),
                    RFQVendQuotes = table.Column<int>(nullable: false),
                    RFQNum = table.Column<int>(nullable: false),
                    RFQLine = table.Column<int>(nullable: false),
                    RFQStat = table.Column<string>(maxLength: 1, nullable: false),
                    SetupGroup = table.Column<string>(maxLength: 8, nullable: false),
                    RestoreFlag = table.Column<string>(maxLength: 14, nullable: false),
                    AnalysisCode = table.Column<string>(maxLength: 8, nullable: false),
                    PrimarySetupOpDtl = table.Column<int>(nullable: false),
                    PrimaryProdOpDtl = table.Column<int>(nullable: false),
                    OpDesc = table.Column<string>(maxLength: 30, nullable: false),
                    KitDate = table.Column<DateTime>(type: "date", nullable: true),
                    GlbRFQ = table.Column<bool>(nullable: false),
                    BookedUnitCost = table.Column<decimal>(nullable: false),
                    RecalcExpProdYld = table.Column<bool>(nullable: false),
                    UserMapData = table.Column<string>(nullable: false),
                    RoughCutSched = table.Column<bool>(nullable: false),
                    SchedComment = table.Column<string>(nullable: false),
                    RptBillableLaborRate = table.Column<decimal>(nullable: false),
                    RptBillableUnitPrice = table.Column<decimal>(nullable: false),
                    RptLaborRate = table.Column<decimal>(nullable: false),
                    RptUnitPrice = table.Column<decimal>(nullable: false),
                    SNRequiredOpr = table.Column<bool>(nullable: false),
                    SNRequiredSubConShip = table.Column<bool>(nullable: false),
                    Weight = table.Column<decimal>(nullable: false),
                    WeightUOM = table.Column<string>(maxLength: 6, nullable: false),
                    SendAheadType = table.Column<string>(maxLength: 8, nullable: false),
                    SendAheadOffset = table.Column<decimal>(nullable: false),
                    PrjRoleList = table.Column<string>(nullable: false),
                    TearDwnEndDate = table.Column<DateTime>(type: "date", nullable: true),
                    TearDwnEndHour = table.Column<decimal>(nullable: false),
                    WITearDwnEndDate = table.Column<DateTime>(type: "date", nullable: true),
                    WITearDwnEndHour = table.Column<decimal>(nullable: false),
                    UseAllRoles = table.Column<bool>(nullable: false),
                    AssetPartNum = table.Column<string>(maxLength: 50, nullable: false),
                    SerialNumber = table.Column<string>(maxLength: 40, nullable: false),
                    ActualStartDate = table.Column<DateTime>(type: "date", nullable: true),
                    ActualStartHour = table.Column<decimal>(nullable: false),
                    ActualEndDate = table.Column<DateTime>(type: "date", nullable: true),
                    ActualEndHour = table.Column<decimal>(nullable: false),
                    FSJobStatus = table.Column<int>(nullable: false),
                    Instructions = table.Column<string>(nullable: false),
                    ProdUOM = table.Column<string>(maxLength: 6, nullable: false),
                    GeneralPlanInfo = table.Column<string>(nullable: false),
                    EstStdDescription = table.Column<string>(nullable: false),
                    JDFOpCompleted = table.Column<bool>(nullable: false),
                    RemovedfromPlan = table.Column<bool>(nullable: false),
                    EstStdType = table.Column<int>(nullable: false),
                    ExternalMES = table.Column<bool>(nullable: false),
                    PctReg = table.Column<decimal>(nullable: false),
                    SetupMaterial = table.Column<decimal>(nullable: false),
                    MaterialColorRating = table.Column<int>(nullable: false),
                    MiscInfo = table.Column<string>(maxLength: 30, nullable: false),
                    SetupURL = table.Column<string>(maxLength: 256, nullable: false),
                    ExpPctUp = table.Column<decimal>(nullable: false),
                    ExpCycTm = table.Column<decimal>(nullable: false),
                    ExpGood = table.Column<decimal>(nullable: false),
                    NonProdLimit = table.Column<decimal>(nullable: false),
                    AutoSpcEnable = table.Column<bool>(nullable: false),
                    AutoSpcPeriod = table.Column<int>(nullable: false),
                    PartQualEnable = table.Column<bool>(nullable: false),
                    AutoSpcSubgroup = table.Column<int>(nullable: false),
                    MobileOperation = table.Column<bool>(nullable: false),
                    ReWork = table.Column<bool>(nullable: false),
                    RequestMove = table.Column<bool>(nullable: false),
                    ContractID = table.Column<string>(maxLength: 50, nullable: false),
                    PrinterID = table.Column<string>(maxLength: 20, nullable: false),
                    LastPrintedDate = table.Column<DateTime>(nullable: true),
                    LastPCIDPrinted = table.Column<string>(maxLength: 12, nullable: false),
                    CurrentPkgCode = table.Column<string>(maxLength: 50, nullable: false),
                    TenantId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_JobOper", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "JobPart",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    Company = table.Column<string>(maxLength: 8, nullable: false),
                    JobNum = table.Column<string>(maxLength: 14, nullable: false),
                    PartNum = table.Column<string>(maxLength: 50, nullable: false),
                    RevisionNum = table.Column<string>(maxLength: 12, nullable: false),
                    PartsPerOp = table.Column<int>(nullable: false),
                    PartQty = table.Column<decimal>(nullable: false),
                    StockQty = table.Column<decimal>(nullable: false),
                    ShippedQty = table.Column<decimal>(nullable: false),
                    ReceivedQty = table.Column<decimal>(nullable: false),
                    WIPQty = table.Column<decimal>(nullable: false),
                    QtyCompleted = table.Column<decimal>(nullable: false),
                    ReservedQty = table.Column<decimal>(nullable: false),
                    AllocatedQty900 = table.Column<decimal>(nullable: false),
                    PickingQty = table.Column<decimal>(nullable: false),
                    PickedQty = table.Column<decimal>(nullable: false),
                    LbrCostBase = table.Column<int>(nullable: false),
                    MtlCostBase = table.Column<int>(nullable: false),
                    JobClosed = table.Column<bool>(nullable: false),
                    JobComplete = table.Column<bool>(nullable: false),
                    Plant = table.Column<string>(maxLength: 8, nullable: false),
                    PartDescription = table.Column<string>(nullable: false),
                    IUM = table.Column<string>(maxLength: 6, nullable: false),
                    ShipDocReq = table.Column<bool>(nullable: false),
                    ShipDocAvail = table.Column<bool>(nullable: false),
                    MtlList = table.Column<string>(nullable: false),
                    PreventSugg = table.Column<bool>(nullable: false),
                    TenantId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_JobPart", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "OpMaster",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    Company = table.Column<string>(maxLength: 8, nullable: true),
                    OpCode = table.Column<string>(maxLength: 8, nullable: true),
                    OpDesc = table.Column<string>(maxLength: 30, nullable: false),
                    OpTextID = table.Column<string>(maxLength: 4, nullable: false),
                    BuyerID = table.Column<string>(maxLength: 8, nullable: false),
                    APSPrepOpF = table.Column<bool>(nullable: false),
                    OPType = table.Column<string>(maxLength: 3, nullable: false),
                    CommentText = table.Column<string>(nullable: false),
                    BillLaborRate = table.Column<decimal>(nullable: false),
                    EstLabHours = table.Column<decimal>(nullable: false),
                    SchedPrecedence = table.Column<int>(nullable: false),
                    AnalysisCode = table.Column<string>(maxLength: 8, nullable: false),
                    PrimarySetupOpDtl = table.Column<int>(nullable: false),
                    PrimaryProdOpDtl = table.Column<int>(nullable: false),
                    VendorNum = table.Column<int>(nullable: false),
                    Subcontract = table.Column<bool>(nullable: false),
                    PrdYldRecalcExpected = table.Column<bool>(nullable: false),
                    PrdYldRecalcUnderPct = table.Column<int>(nullable: false),
                    PrdYldShopWrnAlert = table.Column<bool>(nullable: false),
                    PrdYldShopWrn = table.Column<bool>(nullable: false),
                    PrdYldShopWrnUnderPct = table.Column<int>(nullable: false),
                    PrdYldShopWrnOverPct = table.Column<int>(nullable: false),
                    RestrictSubstance = table.Column<bool>(nullable: false),
                    RoughCutCode = table.Column<string>(maxLength: 12, nullable: false),
                    SendAheadType = table.Column<string>(maxLength: 8, nullable: false),
                    SendAheadOffset = table.Column<decimal>(nullable: false),
                    PrjRoleList = table.Column<string>(nullable: false),
                    RoleCodeDefault = table.Column<string>(maxLength: 20, nullable: false),
                    UseAllRoles = table.Column<bool>(nullable: false),
                    JDFMaterial = table.Column<string>(nullable: false),
                    JDFDevice = table.Column<string>(maxLength: 100, nullable: false),
                    JDFOperation = table.Column<string>(maxLength: 50, nullable: false),
                    ExternalMES = table.Column<bool>(nullable: false),
                    TenantId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_OpMaster", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "OrderDtl",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    VoidLine = table.Column<bool>(nullable: false),
                    OpenLine = table.Column<bool>(nullable: false),
                    Company = table.Column<string>(maxLength: 8, nullable: true),
                    OrderNum = table.Column<int>(nullable: false),
                    OrderLine = table.Column<int>(nullable: false),
                    LineType = table.Column<string>(maxLength: 8, nullable: false),
                    PartNum = table.Column<string>(maxLength: 50, nullable: false),
                    LineDesc = table.Column<string>(nullable: false),
                    Reference = table.Column<string>(maxLength: 10, nullable: false),
                    IUM = table.Column<string>(maxLength: 6, nullable: false),
                    RevisionNum = table.Column<string>(maxLength: 12, nullable: false),
                    POLine = table.Column<string>(maxLength: 20, nullable: false),
                    Commissionable = table.Column<bool>(nullable: false),
                    DiscountPercent = table.Column<decimal>(nullable: false),
                    UnitPrice = table.Column<decimal>(nullable: false),
                    DocUnitPrice = table.Column<decimal>(nullable: false),
                    OrderQty = table.Column<decimal>(nullable: false),
                    Discount = table.Column<decimal>(nullable: false),
                    DocDiscount = table.Column<decimal>(nullable: false),
                    RequestDate = table.Column<DateTime>(type: "date", nullable: true),
                    ProdCode = table.Column<string>(maxLength: 8, nullable: false),
                    XPartNum = table.Column<string>(maxLength: 50, nullable: false),
                    XRevisionNum = table.Column<string>(maxLength: 12, nullable: false),
                    PricePerCode = table.Column<string>(maxLength: 2, nullable: false),
                    OrderComment = table.Column<string>(nullable: false),
                    ShipComment = table.Column<string>(nullable: false),
                    InvoiceComment = table.Column<string>(nullable: false),
                    PickListComment = table.Column<string>(nullable: false),
                    TaxCatID = table.Column<string>(maxLength: 10, nullable: false),
                    AdvanceBillBal = table.Column<decimal>(nullable: false),
                    DocAdvanceBillBal = table.Column<decimal>(nullable: false),
                    QuoteNum = table.Column<int>(nullable: false),
                    QuoteLine = table.Column<int>(nullable: false),
                    TMBilling = table.Column<bool>(nullable: false),
                    OrigWhyNoTax = table.Column<string>(maxLength: 3, nullable: false),
                    NeedByDate = table.Column<DateTime>(type: "date", nullable: true),
                    CustNum = table.Column<int>(nullable: false),
                    Rework = table.Column<bool>(nullable: false),
                    RMANum = table.Column<int>(nullable: false),
                    RMALine = table.Column<int>(nullable: false),
                    ProjectID = table.Column<string>(maxLength: 25, nullable: false),
                    ContractNum = table.Column<int>(nullable: false),
                    ContractCode = table.Column<string>(maxLength: 8, nullable: false),
                    BasePartNum = table.Column<string>(maxLength: 50, nullable: false),
                    Warranty = table.Column<bool>(nullable: false),
                    WarrantyCode = table.Column<string>(maxLength: 8, nullable: false),
                    MaterialDuration = table.Column<int>(nullable: false),
                    LaborDuration = table.Column<int>(nullable: false),
                    MiscDuration = table.Column<int>(nullable: false),
                    MaterialMod = table.Column<string>(maxLength: 8, nullable: false),
                    LaborMod = table.Column<string>(maxLength: 8, nullable: false),
                    WarrantyComment = table.Column<string>(nullable: false),
                    Onsite = table.Column<bool>(nullable: false),
                    MatCovered = table.Column<bool>(nullable: false),
                    LabCovered = table.Column<bool>(nullable: false),
                    MiscCovered = table.Column<bool>(nullable: false),
                    SalesUM = table.Column<string>(maxLength: 6, nullable: false),
                    SellingFactor = table.Column<decimal>(nullable: false),
                    SellingQuantity = table.Column<decimal>(nullable: false),
                    SalesCatID = table.Column<string>(maxLength: 4, nullable: false),
                    ShipLineComplete = table.Column<bool>(nullable: false),
                    CumeQty = table.Column<decimal>(nullable: false),
                    CumeDate = table.Column<DateTime>(type: "date", nullable: true),
                    MktgCampaignID = table.Column<string>(maxLength: 8, nullable: false),
                    MktgEvntSeq = table.Column<int>(nullable: false),
                    LockQty = table.Column<bool>(nullable: false),
                    Linked = table.Column<bool>(nullable: false),
                    ICPONum = table.Column<int>(nullable: false),
                    ICPOLine = table.Column<int>(nullable: false),
                    ExtCompany = table.Column<string>(maxLength: 8, nullable: false),
                    LastConfigDate = table.Column<DateTime>(type: "date", nullable: true),
                    LastConfigTime = table.Column<int>(nullable: false),
                    LastConfigUserID = table.Column<string>(maxLength: 75, nullable: false),
                    ConfigUnitPrice = table.Column<decimal>(nullable: false),
                    ConfigBaseUnitPrice = table.Column<decimal>(nullable: false),
                    PriceListCode = table.Column<string>(maxLength: 10, nullable: false),
                    BreakListCode = table.Column<string>(maxLength: 10, nullable: false),
                    PricingQty = table.Column<decimal>(nullable: false),
                    LockPrice = table.Column<bool>(nullable: false),
                    ListPrice = table.Column<decimal>(nullable: false),
                    DocListPrice = table.Column<decimal>(nullable: false),
                    OrdBasedPrice = table.Column<decimal>(nullable: false),
                    DocOrdBasedPrice = table.Column<decimal>(nullable: false),
                    PriceGroupCode = table.Column<string>(maxLength: 10, nullable: false),
                    OverridePriceList = table.Column<bool>(nullable: false),
                    BaseRevisionNum = table.Column<string>(maxLength: 12, nullable: false),
                    PricingValue = table.Column<decimal>(nullable: false),
                    DisplaySeq = table.Column<decimal>(nullable: false),
                    KitParentLine = table.Column<int>(nullable: false),
                    KitAllowUpdate = table.Column<bool>(nullable: false),
                    KitShipComplete = table.Column<bool>(nullable: false),
                    KitBackFlush = table.Column<bool>(nullable: false),
                    KitPrintCompsPS = table.Column<bool>(nullable: false),
                    KitPrintCompsInv = table.Column<bool>(nullable: false),
                    KitPricing = table.Column<string>(maxLength: 2, nullable: false),
                    KitQtyPer = table.Column<decimal>(nullable: false),
                    SellingFactorDirection = table.Column<string>(maxLength: 1, nullable: false),
                    RepRate = table.Column<decimal>(nullable: false),
                    RepSplit = table.Column<int>(nullable: false),
                    DemandContractLine = table.Column<int>(nullable: false),
                    CreateNewJob = table.Column<bool>(nullable: false),
                    DoNotShipBeforeDate = table.Column<DateTime>(type: "date", nullable: true),
                    GetDtls = table.Column<bool>(nullable: false),
                    DoNotShipAfterDate = table.Column<DateTime>(type: "date", nullable: true),
                    SchedJob = table.Column<bool>(nullable: false),
                    RelJob = table.Column<bool>(nullable: false),
                    EnableCreateNewJob = table.Column<bool>(nullable: false),
                    EnableGetDtls = table.Column<bool>(nullable: false),
                    EnableSchedJob = table.Column<bool>(nullable: false),
                    EnableRelJob = table.Column<bool>(nullable: false),
                    CounterSaleWarehouse = table.Column<string>(maxLength: 8, nullable: false),
                    CounterSaleBinNum = table.Column<string>(maxLength: 10, nullable: false),
                    CounterSaleLotNum = table.Column<string>(maxLength: 30, nullable: false),
                    CounterSaleDimCode = table.Column<string>(maxLength: 6, nullable: false),
                    DemandDtlRejected = table.Column<bool>(nullable: false),
                    KitFlag = table.Column<string>(maxLength: 1, nullable: false),
                    KitsLoaded = table.Column<bool>(nullable: false),
                    DemandContractNum = table.Column<int>(nullable: false),
                    DemandHeadSeq = table.Column<int>(nullable: false),
                    DemandDtlSeq = table.Column<int>(nullable: false),
                    ChangedBy = table.Column<string>(maxLength: 75, nullable: false),
                    ChangeDate = table.Column<DateTime>(type: "date", nullable: true),
                    ChangeTime = table.Column<int>(nullable: false),
                    ReverseCharge = table.Column<bool>(nullable: false),
                    TotalReleases = table.Column<int>(nullable: false),
                    RptUnitPrice = table.Column<decimal>(nullable: false),
                    RptDiscount = table.Column<decimal>(nullable: false),
                    RptAdvanceBillBal = table.Column<decimal>(nullable: false),
                    RptListPrice = table.Column<decimal>(nullable: false),
                    RptOrdBasedPrice = table.Column<decimal>(nullable: false),
                    ExtPriceDtl = table.Column<decimal>(nullable: false),
                    DocExtPriceDtl = table.Column<decimal>(nullable: false),
                    RptExtPriceDtl = table.Column<decimal>(nullable: false),
                    LineStatus = table.Column<string>(maxLength: 20, nullable: false),
                    InUnitPrice = table.Column<decimal>(nullable: false),
                    DocInUnitPrice = table.Column<decimal>(nullable: false),
                    InDiscount = table.Column<decimal>(nullable: false),
                    DocInDiscount = table.Column<decimal>(nullable: false),
                    InListPrice = table.Column<decimal>(nullable: false),
                    DocInListPrice = table.Column<decimal>(nullable: false),
                    InOrdBasedPrice = table.Column<decimal>(nullable: false),
                    DocInOrdBasedPrice = table.Column<decimal>(nullable: false),
                    RptInUnitPrice = table.Column<decimal>(nullable: false),
                    RptInDiscount = table.Column<decimal>(nullable: false),
                    RptInListPrice = table.Column<decimal>(nullable: false),
                    RptInOrdBasedPrice = table.Column<decimal>(nullable: false),
                    InExtPriceDtl = table.Column<decimal>(nullable: false),
                    DocInExtPriceDtl = table.Column<decimal>(nullable: false),
                    RptInExtPriceDtl = table.Column<decimal>(nullable: false),
                    OldOurOpenQty = table.Column<decimal>(nullable: false),
                    OldSellingOpenQty = table.Column<decimal>(nullable: false),
                    OldOpenValue = table.Column<decimal>(nullable: false),
                    OldProdCode = table.Column<string>(maxLength: 8, nullable: false),
                    PrevSellQty = table.Column<decimal>(nullable: false),
                    PrevPartNum = table.Column<string>(maxLength: 50, nullable: false),
                    PrevXPartNum = table.Column<string>(maxLength: 50, nullable: false),
                    KitCompOrigSeq = table.Column<int>(nullable: false),
                    KitCompOrigPart = table.Column<string>(maxLength: 50, nullable: false),
                    SmartStringProcessed = table.Column<bool>(nullable: false),
                    SmartString = table.Column<string>(nullable: false),
                    RenewalNbr = table.Column<int>(nullable: false),
                    DiscBreakListCode = table.Column<string>(maxLength: 10, nullable: false),
                    DiscListPrice = table.Column<decimal>(nullable: false),
                    LockDisc = table.Column<bool>(nullable: false),
                    OverrideDiscPriceList = table.Column<bool>(nullable: false),
                    GroupSeq = table.Column<int>(nullable: false),
                    ECCOrderNum = table.Column<string>(maxLength: 50, nullable: false),
                    ECCOrderLine = table.Column<int>(nullable: false),
                    DupOnJobCrt = table.Column<bool>(nullable: false),
                    UndersPct = table.Column<decimal>(nullable: false),
                    Overs = table.Column<decimal>(nullable: false),
                    Unders = table.Column<decimal>(nullable: false),
                    OversUnitPrice = table.Column<decimal>(nullable: false),
                    PlanUserID = table.Column<string>(maxLength: 50, nullable: false),
                    PlanGUID = table.Column<string>(maxLength: 256, nullable: false),
                    MOMsourceType = table.Column<string>(maxLength: 50, nullable: false),
                    MOMsourceEst = table.Column<string>(maxLength: 50, nullable: false),
                    DefaultOversPricing = table.Column<string>(maxLength: 50, nullable: false),
                    ECCPlant = table.Column<string>(maxLength: 8, nullable: false),
                    ECCQuoteNum = table.Column<string>(maxLength: 10, nullable: false),
                    ECCQuoteLine = table.Column<int>(nullable: false),
                    MfgJobType = table.Column<string>(maxLength: 3, nullable: false),
                    ProFormaInvComment = table.Column<string>(nullable: false),
                    CreateJob = table.Column<bool>(nullable: false),
                    ContractID = table.Column<string>(maxLength: 50, nullable: false),
                    LinkToContract = table.Column<bool>(nullable: false),
                    DocInAdvanceBillBal = table.Column<decimal>(nullable: false),
                    InAdvanceBillBal = table.Column<decimal>(nullable: false),
                    RptInAdvanceBillBal = table.Column<decimal>(nullable: false),
                    PCLinkRemoved = table.Column<bool>(nullable: false),
                    TenantId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_OrderDtl", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "OrderHed",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    OpenOrder = table.Column<bool>(nullable: false),
                    VoidOrder = table.Column<bool>(nullable: false),
                    Company = table.Column<string>(maxLength: 8, nullable: true),
                    OrderNum = table.Column<int>(nullable: false),
                    CustNum = table.Column<int>(nullable: false),
                    PONum = table.Column<string>(maxLength: 50, nullable: false),
                    OrderHeld = table.Column<bool>(nullable: false),
                    EntryPerson = table.Column<string>(maxLength: 75, nullable: false),
                    ShipToNum = table.Column<string>(maxLength: 14, nullable: false),
                    RequestDate = table.Column<DateTime>(type: "date", nullable: true),
                    OrderDate = table.Column<DateTime>(type: "date", nullable: true),
                    FOB = table.Column<string>(maxLength: 15, nullable: false),
                    ShipViaCode = table.Column<string>(maxLength: 4, nullable: false),
                    TermsCode = table.Column<string>(maxLength: 4, nullable: false),
                    DiscountPercent = table.Column<decimal>(nullable: false),
                    PrcConNum = table.Column<int>(nullable: false),
                    ShpConNum = table.Column<int>(nullable: false),
                    SalesRepList = table.Column<string>(nullable: false),
                    OrderComment = table.Column<string>(nullable: false),
                    ShipComment = table.Column<string>(nullable: false),
                    InvoiceComment = table.Column<string>(nullable: false),
                    PickListComment = table.Column<string>(nullable: false),
                    DepositBal = table.Column<decimal>(nullable: false),
                    DocDepositBal = table.Column<decimal>(nullable: false),
                    NeedByDate = table.Column<DateTime>(type: "date", nullable: true),
                    CreditOverride = table.Column<bool>(nullable: false),
                    CreditOverrideUserID = table.Column<string>(maxLength: 75, nullable: false),
                    CreditOverrideDate = table.Column<DateTime>(type: "date", nullable: true),
                    CreditOverrideTime = table.Column<string>(maxLength: 8, nullable: false),
                    CreditOverrideLimit = table.Column<decimal>(nullable: false),
                    SndAlrtShp = table.Column<bool>(nullable: false),
                    ExchangeRate = table.Column<decimal>(nullable: false),
                    CurrencyCode = table.Column<string>(maxLength: 4, nullable: false),
                    LockRate = table.Column<bool>(nullable: false),
                    CardMemberName = table.Column<string>(maxLength: 54, nullable: false),
                    CardNumber = table.Column<string>(maxLength: 20, nullable: false),
                    CardType = table.Column<string>(maxLength: 4, nullable: false),
                    ExpirationMonth = table.Column<int>(nullable: false),
                    ExpirationYear = table.Column<int>(nullable: false),
                    CardID = table.Column<string>(maxLength: 4, nullable: false),
                    CardmemberReference = table.Column<string>(maxLength: 17, nullable: false),
                    AllocPriorityCode = table.Column<string>(maxLength: 6, nullable: false),
                    ReservePriorityCode = table.Column<string>(maxLength: 6, nullable: false),
                    ShipOrderComplete = table.Column<bool>(nullable: false),
                    WebOrder = table.Column<bool>(nullable: false),
                    CCApprovalNum = table.Column<string>(maxLength: 99, nullable: false),
                    EDIOrder = table.Column<bool>(nullable: false),
                    EDIAck = table.Column<bool>(nullable: false),
                    Linked = table.Column<bool>(nullable: false),
                    ICPONum = table.Column<int>(nullable: false),
                    ExtCompany = table.Column<string>(maxLength: 8, nullable: false),
                    WebEntryPerson = table.Column<string>(maxLength: 40, nullable: false),
                    AckEmailSent = table.Column<bool>(nullable: false),
                    ApplyOrderBasedDisc = table.Column<bool>(nullable: false),
                    AutoOrderBasedDisc = table.Column<bool>(nullable: false),
                    EntryMethod = table.Column<string>(maxLength: 2, nullable: false),
                    HDCaseNum = table.Column<int>(nullable: false),
                    CounterSale = table.Column<bool>(nullable: false),
                    CreateInvoice = table.Column<bool>(nullable: false),
                    CreatePackingSlip = table.Column<bool>(nullable: false),
                    LockQty = table.Column<bool>(nullable: false),
                    ProcessCard = table.Column<string>(maxLength: 256, nullable: false),
                    CCAmount = table.Column<decimal>(nullable: false),
                    CCFreight = table.Column<decimal>(nullable: false),
                    CCTax = table.Column<decimal>(nullable: false),
                    CCTotal = table.Column<decimal>(nullable: false),
                    CCDocAmount = table.Column<decimal>(nullable: false),
                    CCDocFreight = table.Column<decimal>(nullable: false),
                    CCDocTax = table.Column<decimal>(nullable: false),
                    CCDocTotal = table.Column<decimal>(nullable: false),
                    CCStreetAddr = table.Column<string>(maxLength: 50, nullable: false),
                    CCZip = table.Column<string>(maxLength: 10, nullable: false),
                    BTCustNum = table.Column<int>(nullable: false),
                    BTConNum = table.Column<int>(nullable: false),
                    RepRate = table.Column<decimal>(nullable: false),
                    RepSplit = table.Column<int>(nullable: false),
                    OutboundSalesDocCtr = table.Column<int>(nullable: false),
                    OutboundShipDocsCtr = table.Column<int>(nullable: false),
                    DemandContractNum = table.Column<int>(nullable: false),
                    DoNotShipBeforeDate = table.Column<DateTime>(type: "date", nullable: true),
                    ResDelivery = table.Column<bool>(nullable: false),
                    DoNotShipAfterDate = table.Column<DateTime>(type: "date", nullable: true),
                    SatDelivery = table.Column<bool>(nullable: false),
                    SatPickup = table.Column<bool>(nullable: false),
                    Hazmat = table.Column<bool>(nullable: false),
                    DocOnly = table.Column<bool>(nullable: false),
                    RefNotes = table.Column<string>(maxLength: 500, nullable: false),
                    ApplyChrg = table.Column<bool>(nullable: false),
                    ChrgAmount = table.Column<decimal>(nullable: false),
                    COD = table.Column<bool>(nullable: false),
                    CODFreight = table.Column<bool>(nullable: false),
                    CODCheck = table.Column<bool>(nullable: false),
                    CODAmount = table.Column<decimal>(nullable: false),
                    GroundType = table.Column<string>(maxLength: 8, nullable: false),
                    NotifyFlag = table.Column<bool>(nullable: false),
                    NotifyEMail = table.Column<string>(maxLength: 500, nullable: false),
                    DeclaredIns = table.Column<bool>(nullable: false),
                    DeclaredAmt = table.Column<decimal>(nullable: false),
                    CancelAfterDate = table.Column<DateTime>(type: "date", nullable: true),
                    DemandRejected = table.Column<bool>(nullable: false),
                    OverrideCarrier = table.Column<bool>(nullable: false),
                    OverrideService = table.Column<bool>(nullable: false),
                    CreditCardOrder = table.Column<bool>(nullable: false),
                    DemandHeadSeq = table.Column<int>(nullable: false),
                    PayFlag = table.Column<string>(maxLength: 8, nullable: false),
                    PayAccount = table.Column<string>(maxLength: 50, nullable: false),
                    PayBTAddress = table.Column<string>(maxLength: 50, nullable: false),
                    PayBTCity = table.Column<string>(maxLength: 50, nullable: false),
                    PayBTState = table.Column<string>(maxLength: 50, nullable: false),
                    PayBTZip = table.Column<string>(maxLength: 10, nullable: false),
                    PayBTCountry = table.Column<string>(maxLength: 50, nullable: false),
                    DropShip = table.Column<bool>(nullable: false),
                    CommercialInvoice = table.Column<bool>(nullable: false),
                    ShipExprtDeclartn = table.Column<bool>(nullable: false),
                    CertOfOrigin = table.Column<bool>(nullable: false),
                    LetterOfInstr = table.Column<bool>(nullable: false),
                    FFID = table.Column<string>(maxLength: 8, nullable: false),
                    FFAddress1 = table.Column<string>(maxLength: 50, nullable: false),
                    FFAddress2 = table.Column<string>(maxLength: 50, nullable: false),
                    FFCity = table.Column<string>(maxLength: 50, nullable: false),
                    FFState = table.Column<string>(maxLength: 50, nullable: false),
                    FFZip = table.Column<string>(maxLength: 10, nullable: false),
                    FFCountry = table.Column<string>(maxLength: 50, nullable: false),
                    FFContact = table.Column<string>(maxLength: 50, nullable: false),
                    FFCompName = table.Column<string>(maxLength: 50, nullable: false),
                    FFPhoneNum = table.Column<string>(maxLength: 20, nullable: false),
                    IntrntlShip = table.Column<bool>(nullable: false),
                    ChangedBy = table.Column<string>(maxLength: 75, nullable: false),
                    ChangeDate = table.Column<DateTime>(type: "date", nullable: true),
                    ChangeTime = table.Column<int>(nullable: false),
                    AutoPrintReady = table.Column<bool>(nullable: false),
                    EDIReady = table.Column<bool>(nullable: false),
                    IndividualPackIDs = table.Column<bool>(nullable: false),
                    FFAddress3 = table.Column<string>(maxLength: 50, nullable: false),
                    DeliveryConf = table.Column<int>(nullable: false),
                    AddlHdlgFlag = table.Column<bool>(nullable: false),
                    NonStdPkg = table.Column<bool>(nullable: false),
                    ServSignature = table.Column<bool>(nullable: false),
                    ServAlert = table.Column<bool>(nullable: false),
                    ServHomeDel = table.Column<bool>(nullable: false),
                    DeliveryType = table.Column<string>(maxLength: 8, nullable: false),
                    ServDeliveryDate = table.Column<DateTime>(type: "date", nullable: true),
                    ServInstruct = table.Column<string>(maxLength: 100, nullable: false),
                    ServRef = table.Column<string>(maxLength: 50, nullable: false),
                    FFCountryNum = table.Column<int>(nullable: false),
                    ServPhone = table.Column<string>(maxLength: 20, nullable: false),
                    ServRelease = table.Column<bool>(nullable: false),
                    ServAuthNum = table.Column<string>(maxLength: 50, nullable: false),
                    PayBTCountryNum = table.Column<int>(nullable: false),
                    PayBTPhone = table.Column<string>(maxLength: 20, nullable: false),
                    UPSQuantumView = table.Column<bool>(nullable: false),
                    UPSQVShipFromName = table.Column<string>(maxLength: 50, nullable: false),
                    UPSQVMemo = table.Column<string>(nullable: false),
                    ReadyToCalc = table.Column<bool>(nullable: false),
                    TotalCharges = table.Column<decimal>(nullable: false),
                    TotalMisc = table.Column<decimal>(nullable: false),
                    TotalDiscount = table.Column<decimal>(nullable: false),
                    TotalComm = table.Column<decimal>(nullable: false),
                    TotalAdvBill = table.Column<decimal>(nullable: false),
                    TotalLines = table.Column<int>(nullable: false),
                    TotalReleases = table.Column<int>(nullable: false),
                    TotalRelDates = table.Column<int>(nullable: false),
                    DocTotalCharges = table.Column<decimal>(nullable: false),
                    DocTotalMisc = table.Column<decimal>(nullable: false),
                    DocTotalDiscount = table.Column<decimal>(nullable: false),
                    DocTotalComm = table.Column<decimal>(nullable: false),
                    TotalTax = table.Column<decimal>(nullable: false),
                    DocTotalTax = table.Column<decimal>(nullable: false),
                    DocTotalAdvBill = table.Column<decimal>(nullable: false),
                    TotalShipped = table.Column<decimal>(nullable: false),
                    TotalInvoiced = table.Column<decimal>(nullable: false),
                    TotalCommLines = table.Column<int>(nullable: false),
                    SRCommAmt = table.Column<decimal>(nullable: false),
                    SRCommableAmt = table.Column<decimal>(nullable: false),
                    Rounding = table.Column<decimal>(nullable: false),
                    DocRounding = table.Column<decimal>(nullable: false),
                    RptDepositBal = table.Column<decimal>(nullable: false),
                    RptTotalCharges = table.Column<decimal>(nullable: false),
                    RptTotalAdvBill = table.Column<decimal>(nullable: false),
                    RptTotalMisc = table.Column<decimal>(nullable: false),
                    RptTotalDiscount = table.Column<decimal>(nullable: false),
                    RptTotalComm = table.Column<decimal>(nullable: false),
                    RptTotalTax = table.Column<decimal>(nullable: false),
                    RptRounding = table.Column<decimal>(nullable: false),
                    RateGrpCode = table.Column<string>(maxLength: 12, nullable: false),
                    Rpt3TotalTax = table.Column<decimal>(nullable: false),
                    RptCCAmount = table.Column<decimal>(nullable: false),
                    RptCCFreight = table.Column<decimal>(nullable: false),
                    RptCCTax = table.Column<decimal>(nullable: false),
                    RptCCTotal = table.Column<decimal>(nullable: false),
                    OrderAmt = table.Column<decimal>(nullable: false),
                    DocOrderAmt = table.Column<decimal>(nullable: false),
                    RptOrderAmt = table.Column<decimal>(nullable: false),
                    TaxPoint = table.Column<DateTime>(type: "date", nullable: true),
                    TaxRateDate = table.Column<DateTime>(type: "date", nullable: true),
                    TaxRegionCode = table.Column<string>(maxLength: 4, nullable: false),
                    UseOTS = table.Column<bool>(nullable: false),
                    OTSName = table.Column<string>(maxLength: 50, nullable: false),
                    OTSAddress = table.Column<string>(maxLength: 50, nullable: false),
                    OTSCity = table.Column<string>(maxLength: 50, nullable: false),
                    OTSState = table.Column<string>(maxLength: 50, nullable: false),
                    OTSZIP = table.Column<string>(maxLength: 10, nullable: false),
                    OTSResaleID = table.Column<string>(maxLength: 20, nullable: false),
                    OTSContact = table.Column<string>(maxLength: 50, nullable: false),
                    OTSFaxNum = table.Column<string>(maxLength: 20, nullable: false),
                    OTSPhoneNum = table.Column<string>(maxLength: 20, nullable: false),
                    OTSCountryNum = table.Column<int>(nullable: false),
                    TotalWHTax = table.Column<decimal>(nullable: false),
                    DocTotalWHTax = table.Column<decimal>(nullable: false),
                    RptTotalWHTax = table.Column<decimal>(nullable: false),
                    TotalSATax = table.Column<decimal>(nullable: false),
                    DocTotalSATax = table.Column<decimal>(nullable: false),
                    RptTotalSATax = table.Column<decimal>(nullable: false),
                    OTSSaveAs = table.Column<string>(maxLength: 2, nullable: false),
                    OTSSaveCustID = table.Column<string>(maxLength: 10, nullable: false),
                    OTSCustSaved = table.Column<bool>(nullable: false),
                    ShipToCustNum = table.Column<int>(nullable: false),
                    OrderStatus = table.Column<string>(maxLength: 20, nullable: false),
                    HoldSetByDemand = table.Column<bool>(nullable: false),
                    InPrice = table.Column<bool>(nullable: false),
                    InTotalCharges = table.Column<decimal>(nullable: false),
                    InTotalMisc = table.Column<decimal>(nullable: false),
                    InTotalDiscount = table.Column<decimal>(nullable: false),
                    DocInTotalCharges = table.Column<decimal>(nullable: false),
                    DocInTotalMisc = table.Column<decimal>(nullable: false),
                    DocInTotalDiscount = table.Column<decimal>(nullable: false),
                    RptInTotalCharges = table.Column<decimal>(nullable: false),
                    RptInTotalMisc = table.Column<decimal>(nullable: false),
                    RptInTotalDiscount = table.Column<decimal>(nullable: false),
                    ARLOCID = table.Column<string>(maxLength: 20, nullable: false),
                    OurBank = table.Column<string>(maxLength: 5, nullable: false),
                    ERSOrder = table.Column<bool>(nullable: false),
                    LOCHold = table.Column<bool>(nullable: false),
                    PSCurrCode = table.Column<string>(maxLength: 4, nullable: false),
                    InvCurrCode = table.Column<string>(maxLength: 4, nullable: false),
                    LegalNumber = table.Column<string>(maxLength: 30, nullable: false),
                    TranDocTypeID = table.Column<string>(maxLength: 12, nullable: false),
                    XRefContractNum = table.Column<string>(maxLength: 20, nullable: false),
                    XRefContractDate = table.Column<DateTime>(type: "date", nullable: true),
                    DemandProcessDate = table.Column<DateTime>(type: "date", nullable: true),
                    DemandProcessTime = table.Column<int>(nullable: false),
                    LastScheduleNumber = table.Column<string>(maxLength: 30, nullable: false),
                    LastTCtrlNum = table.Column<string>(maxLength: 25, nullable: false),
                    LastBatchNum = table.Column<string>(maxLength: 25, nullable: false),
                    ECCOrderNum = table.Column<string>(maxLength: 50, nullable: false),
                    ECCPONum = table.Column<string>(maxLength: 255, nullable: false),
                    WIOrder = table.Column<string>(maxLength: 100, nullable: false),
                    WIApplication = table.Column<string>(maxLength: 50, nullable: false),
                    WIUsername = table.Column<string>(maxLength: 50, nullable: false),
                    WIUserID = table.Column<string>(maxLength: 75, nullable: false),
                    WICreditCardorder = table.Column<bool>(nullable: false),
                    OrderCSR = table.Column<string>(maxLength: 50, nullable: false),
                    UserChar = table.Column<string>(maxLength: 30, nullable: false),
                    UserDate = table.Column<DateTime>(type: "date", nullable: true),
                    UserDecimal = table.Column<decimal>(nullable: false),
                    UserInteger = table.Column<int>(nullable: false),
                    IsCSRSet = table.Column<bool>(nullable: false),
                    ECCPaymentMethod = table.Column<string>(maxLength: 4, nullable: false),
                    AGUseGoodDefaultMark = table.Column<bool>(nullable: false),
                    OTSShipToNum = table.Column<string>(maxLength: 14, nullable: false),
                    ProFormaInvComment = table.Column<string>(nullable: false),
                    ccToken = table.Column<string>(maxLength: 100, nullable: false),
                    InvcOrderCmp = table.Column<bool>(nullable: false),
                    ReprintSOAck = table.Column<bool>(nullable: false),
                    CounterSOAck = table.Column<int>(nullable: false),
                    DispatchReason = table.Column<string>(maxLength: 8, nullable: false),
                    Plant = table.Column<string>(maxLength: 8, nullable: false),
                    ReadyToFulfill = table.Column<bool>(nullable: false),
                    ShipByTime = table.Column<int>(nullable: false),
                    TWFiscalYear = table.Column<int>(nullable: false),
                    TWFiscalYearSuffix = table.Column<string>(maxLength: 8, nullable: false),
                    TWFiscalPeriod = table.Column<int>(nullable: false),
                    TWGUIGroup = table.Column<string>(maxLength: 2, nullable: false),
                    TWGUIRegNumSeller = table.Column<string>(maxLength: 8, nullable: false),
                    TWGUIRegNumBuyer = table.Column<string>(maxLength: 8, nullable: false),
                    OrderOpenCredit = table.Column<decimal>(nullable: false),
                    ClosedNotShipped = table.Column<decimal>(nullable: false),
                    TenantId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_OrderHed", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "OrderRel",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    Company = table.Column<string>(maxLength: 8, nullable: true),
                    OrderNum = table.Column<int>(nullable: false),
                    OrderLine = table.Column<int>(nullable: false),
                    OrderRelNum = table.Column<int>(nullable: false),
                    LineType = table.Column<string>(maxLength: 8, nullable: false),
                    ReqDate = table.Column<DateTime>(type: "date", nullable: true),
                    OurReqQty = table.Column<decimal>(nullable: false),
                    ShipToNum = table.Column<string>(maxLength: 14, nullable: false),
                    ShipViaCode = table.Column<string>(maxLength: 4, nullable: false),
                    OpenRelease = table.Column<bool>(nullable: false),
                    FirmRelease = table.Column<bool>(nullable: false),
                    Make = table.Column<bool>(nullable: false),
                    OurJobQty = table.Column<decimal>(nullable: false),
                    OurJobShippedQty = table.Column<decimal>(nullable: false),
                    VoidRelease = table.Column<bool>(nullable: false),
                    OurStockQty = table.Column<decimal>(nullable: false),
                    WarehouseCode = table.Column<string>(maxLength: 8, nullable: false),
                    OurStockShippedQty = table.Column<decimal>(nullable: false),
                    PartNum = table.Column<string>(maxLength: 50, nullable: false),
                    RevisionNum = table.Column<string>(maxLength: 12, nullable: false),
                    TaxExempt = table.Column<string>(maxLength: 3, nullable: false),
                    ShpConNum = table.Column<int>(nullable: false),
                    NeedByDate = table.Column<DateTime>(type: "date", nullable: true),
                    Reference = table.Column<string>(maxLength: 30, nullable: false),
                    Plant = table.Column<string>(maxLength: 8, nullable: false),
                    SellingReqQty = table.Column<decimal>(nullable: false),
                    SellingJobQty = table.Column<decimal>(nullable: false),
                    SellingJobShippedQty = table.Column<decimal>(nullable: false),
                    SellingStockQty = table.Column<decimal>(nullable: false),
                    SellingStockShippedQty = table.Column<decimal>(nullable: false),
                    SelectForPicking = table.Column<bool>(nullable: false),
                    StagingWarehouseCode = table.Column<string>(maxLength: 8, nullable: false),
                    StagingBinNum = table.Column<string>(maxLength: 10, nullable: false),
                    PickError = table.Column<string>(maxLength: 2, nullable: false),
                    CumeQty = table.Column<decimal>(nullable: false),
                    CumeDate = table.Column<DateTime>(type: "date", nullable: true),
                    Linked = table.Column<bool>(nullable: false),
                    ICPONum = table.Column<int>(nullable: false),
                    ICPOLine = table.Column<int>(nullable: false),
                    ICPORelNum = table.Column<int>(nullable: false),
                    ExtCompany = table.Column<string>(maxLength: 8, nullable: false),
                    ScheduleNumber = table.Column<string>(maxLength: 30, nullable: false),
                    MarkForNum = table.Column<string>(maxLength: 14, nullable: false),
                    DropShipName = table.Column<string>(maxLength: 50, nullable: false),
                    RAN = table.Column<string>(maxLength: 30, nullable: false),
                    DemandReference = table.Column<string>(maxLength: 30, nullable: false),
                    DemandSchedRejected = table.Column<bool>(nullable: false),
                    DatePickTicketPrinted = table.Column<DateTime>(type: "date", nullable: true),
                    ResDelivery = table.Column<bool>(nullable: false),
                    SatDelivery = table.Column<bool>(nullable: false),
                    SatPickup = table.Column<bool>(nullable: false),
                    VerbalConf = table.Column<bool>(nullable: false),
                    Hazmat = table.Column<bool>(nullable: false),
                    DocOnly = table.Column<bool>(nullable: false),
                    RefNotes = table.Column<string>(maxLength: 500, nullable: false),
                    ApplyChrg = table.Column<bool>(nullable: false),
                    ChrgAmount = table.Column<decimal>(nullable: false),
                    COD = table.Column<bool>(nullable: false),
                    CODFreight = table.Column<bool>(nullable: false),
                    CODCheck = table.Column<bool>(nullable: false),
                    CODAmount = table.Column<decimal>(nullable: false),
                    GroundType = table.Column<string>(maxLength: 8, nullable: false),
                    NotifyFlag = table.Column<bool>(nullable: false),
                    NotifyEMail = table.Column<string>(maxLength: 500, nullable: false),
                    DeclaredIns = table.Column<bool>(nullable: false),
                    DeclaredAmt = table.Column<decimal>(nullable: false),
                    ServSatDelivery = table.Column<bool>(nullable: false),
                    ServSatPickup = table.Column<bool>(nullable: false),
                    ServSignature = table.Column<bool>(nullable: false),
                    ServAlert = table.Column<bool>(nullable: false),
                    ServPOD = table.Column<bool>(nullable: false),
                    ServAOD = table.Column<bool>(nullable: false),
                    ServHomeDel = table.Column<bool>(nullable: false),
                    DeliveryType = table.Column<string>(maxLength: 8, nullable: false),
                    ServDeliveryDate = table.Column<DateTime>(type: "date", nullable: true),
                    ServPhone = table.Column<string>(maxLength: 20, nullable: false),
                    ServInstruct = table.Column<string>(maxLength: 100, nullable: false),
                    ServRelease = table.Column<bool>(nullable: false),
                    ServAuthNum = table.Column<string>(maxLength: 50, nullable: false),
                    ServRef = table.Column<string>(maxLength: 50, nullable: false),
                    OverrideCarrier = table.Column<bool>(nullable: false),
                    OverrideService = table.Column<bool>(nullable: false),
                    DockingStation = table.Column<string>(maxLength: 30, nullable: false),
                    Location = table.Column<string>(maxLength: 30, nullable: false),
                    TransportID = table.Column<string>(maxLength: 30, nullable: false),
                    ShipbyTime = table.Column<int>(nullable: false),
                    ChangedBy = table.Column<string>(maxLength: 75, nullable: false),
                    ChangeDate = table.Column<DateTime>(type: "date", nullable: true),
                    ChangeTime = table.Column<int>(nullable: false),
                    TaxConnectCalc = table.Column<bool>(nullable: false),
                    GetDfltTaxIds = table.Column<bool>(nullable: false),
                    TaxRegionCode = table.Column<string>(maxLength: 4, nullable: false),
                    UseOTS = table.Column<bool>(nullable: false),
                    OTSName = table.Column<string>(maxLength: 50, nullable: false),
                    OTSAddress = table.Column<string>(maxLength: 50, nullable: false),
                    OTSCity = table.Column<string>(maxLength: 50, nullable: false),
                    OTSState = table.Column<string>(maxLength: 50, nullable: false),
                    OTSZIP = table.Column<string>(maxLength: 10, nullable: false),
                    OTSResaleID = table.Column<string>(maxLength: 20, nullable: false),
                    OTSContact = table.Column<string>(maxLength: 50, nullable: false),
                    OTSFaxNum = table.Column<string>(maxLength: 20, nullable: false),
                    OTSPhoneNum = table.Column<string>(maxLength: 20, nullable: false),
                    OTSCountryNum = table.Column<int>(nullable: false),
                    SubShipTo = table.Column<string>(maxLength: 50, nullable: false),
                    ShipRouting = table.Column<string>(maxLength: 50, nullable: false),
                    BuyToOrder = table.Column<bool>(nullable: false),
                    VendorNum = table.Column<int>(nullable: false),
                    PurPoint = table.Column<string>(maxLength: 4, nullable: false),
                    DropShip = table.Column<bool>(nullable: false),
                    PONum = table.Column<int>(nullable: false),
                    POLine = table.Column<int>(nullable: false),
                    PORelNum = table.Column<int>(nullable: false),
                    OpenOrder = table.Column<bool>(nullable: false),
                    OTSSaveAs = table.Column<string>(maxLength: 2, nullable: false),
                    OTSSaveCustID = table.Column<string>(maxLength: 10, nullable: false),
                    OTSCustSaved = table.Column<bool>(nullable: false),
                    ShipToCustNum = table.Column<int>(nullable: false),
                    IUM = table.Column<string>(maxLength: 6, nullable: false),
                    SalesUM = table.Column<string>(maxLength: 6, nullable: false),
                    RelStatus = table.Column<string>(maxLength: 20, nullable: false),
                    ComplianceMsg = table.Column<string>(nullable: false),
                    PrevSellQty = table.Column<decimal>(nullable: false),
                    PrevPartNum = table.Column<string>(maxLength: 50, nullable: false),
                    PrevXPartNum = table.Column<string>(maxLength: 50, nullable: false),
                    PrevNeedByDate = table.Column<DateTime>(type: "date", nullable: true),
                    PrevReqDate = table.Column<DateTime>(type: "date", nullable: true),
                    PrevShipToNum = table.Column<string>(maxLength: 14, nullable: false),
                    MFCustNum = table.Column<int>(nullable: false),
                    UseOTMF = table.Column<bool>(nullable: false),
                    OTMFName = table.Column<string>(maxLength: 50, nullable: false),
                    OTMFAddress = table.Column<string>(maxLength: 50, nullable: false),
                    OTMFCity = table.Column<string>(maxLength: 50, nullable: false),
                    OTMFState = table.Column<string>(maxLength: 50, nullable: false),
                    OTMFZIP = table.Column<string>(maxLength: 10, nullable: false),
                    OTMFContact = table.Column<string>(maxLength: 50, nullable: false),
                    OTMFFaxNum = table.Column<string>(maxLength: 20, nullable: false),
                    OTMFPhoneNum = table.Column<string>(maxLength: 20, nullable: false),
                    OTMFCountryNum = table.Column<int>(nullable: false),
                    ECCPlant = table.Column<string>(maxLength: 8, nullable: false),
                    WIOrderLine = table.Column<string>(maxLength: 20, nullable: false),
                    WIOrder = table.Column<string>(maxLength: 20, nullable: false),
                    WebSKU = table.Column<string>(maxLength: 256, nullable: false),
                    ShipOvers = table.Column<bool>(nullable: false),
                    WIItemPrice = table.Column<decimal>(nullable: false),
                    WIItemShipCost = table.Column<decimal>(nullable: false),
                    EntityUseCode = table.Column<string>(maxLength: 10, nullable: false),
                    PhaseID = table.Column<string>(maxLength: 12, nullable: false),
                    OTSShipToNum = table.Column<string>(maxLength: 14, nullable: false),
                    WasRecInvoiced = table.Column<bool>(nullable: false),
                    ContractID = table.Column<string>(maxLength: 50, nullable: false),
                    LinkToContract = table.Column<bool>(nullable: false),
                    ReadyToFulfill = table.Column<bool>(nullable: false),
                    TenantId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_OrderRel", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "PODetail",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    Company = table.Column<string>(maxLength: 8, nullable: true),
                    OpenLine = table.Column<bool>(nullable: false),
                    VoidLine = table.Column<bool>(nullable: false),
                    PONUM = table.Column<int>(nullable: false),
                    POLine = table.Column<int>(nullable: false),
                    LineDesc = table.Column<string>(nullable: false),
                    IUM = table.Column<string>(maxLength: 6, nullable: false),
                    UnitCost = table.Column<decimal>(nullable: false),
                    DocUnitCost = table.Column<decimal>(nullable: false),
                    OrderQty = table.Column<decimal>(nullable: false),
                    XOrderQty = table.Column<decimal>(nullable: false),
                    Taxable = table.Column<bool>(nullable: false),
                    PUM = table.Column<string>(maxLength: 6, nullable: false),
                    CostPerCode = table.Column<string>(maxLength: 2, nullable: false),
                    PartNum = table.Column<string>(maxLength: 50, nullable: false),
                    VenPartNum = table.Column<string>(maxLength: 50, nullable: false),
                    CommentText = table.Column<string>(nullable: false),
                    ClassID = table.Column<string>(maxLength: 4, nullable: false),
                    RevisionNum = table.Column<string>(maxLength: 12, nullable: false),
                    RcvInspectionReq = table.Column<bool>(nullable: false),
                    VendorNum = table.Column<int>(nullable: false),
                    AdvancePayBal = table.Column<decimal>(nullable: false),
                    DocAdvancePayBal = table.Column<decimal>(nullable: false),
                    Confirmed = table.Column<bool>(nullable: false),
                    DateChgReq = table.Column<bool>(nullable: false),
                    QtyChgReq = table.Column<bool>(nullable: false),
                    PartNumChgReq = table.Column<string>(maxLength: 50, nullable: false),
                    RevisionNumChgReq = table.Column<string>(maxLength: 12, nullable: false),
                    ConfirmDate = table.Column<DateTime>(type: "date", nullable: true),
                    ConfirmVia = table.Column<string>(maxLength: 8, nullable: false),
                    PrcChgReq = table.Column<decimal>(nullable: false),
                    PurchCode = table.Column<string>(maxLength: 8, nullable: false),
                    OrderNum = table.Column<int>(nullable: false),
                    OrderLine = table.Column<int>(nullable: false),
                    Linked = table.Column<bool>(nullable: false),
                    ExtCompany = table.Column<string>(maxLength: 8, nullable: false),
                    GlbCompany = table.Column<string>(maxLength: 8, nullable: false),
                    ContractActive = table.Column<bool>(nullable: false),
                    ContractQty = table.Column<decimal>(nullable: false),
                    ContractUnitCost = table.Column<decimal>(nullable: false),
                    ContractDocUnitCost = table.Column<decimal>(nullable: false),
                    RptAdvancePayBal = table.Column<decimal>(nullable: false),
                    RptUnitCost = table.Column<decimal>(nullable: false),
                    ContractQtyUOM = table.Column<string>(maxLength: 6, nullable: false),
                    RptContractUnitCost = table.Column<decimal>(nullable: false),
                    BaseQty = table.Column<decimal>(nullable: false),
                    BaseUOM = table.Column<string>(maxLength: 6, nullable: false),
                    BTOOrderNum = table.Column<int>(nullable: false),
                    BTOOrderLine = table.Column<int>(nullable: false),
                    VendorPartOpts = table.Column<string>(maxLength: 1, nullable: false),
                    MfgPartOpts = table.Column<string>(maxLength: 1, nullable: false),
                    SubPartOpts = table.Column<string>(maxLength: 1, nullable: false),
                    MfgNum = table.Column<int>(nullable: false),
                    MfgPartNum = table.Column<string>(maxLength: 50, nullable: false),
                    SubPartNum = table.Column<string>(maxLength: 50, nullable: false),
                    SubPartType = table.Column<string>(maxLength: 1, nullable: false),
                    ConfigUnitCost = table.Column<decimal>(nullable: false),
                    ConfigBaseUnitCost = table.Column<decimal>(nullable: false),
                    ConvOverRide = table.Column<bool>(nullable: false),
                    BasePartNum = table.Column<string>(maxLength: 50, nullable: false),
                    BaseRevisionNum = table.Column<string>(maxLength: 12, nullable: false),
                    Direction = table.Column<string>(maxLength: 50, nullable: false),
                    Per = table.Column<string>(maxLength: 50, nullable: false),
                    ShipToSupplierDate = table.Column<DateTime>(type: "date", nullable: true),
                    Factor = table.Column<decimal>(nullable: false),
                    PricingQty = table.Column<decimal>(nullable: false),
                    PricingUnitPrice = table.Column<decimal>(nullable: false),
                    UOM = table.Column<string>(maxLength: 6, nullable: false),
                    GroupSeq = table.Column<int>(nullable: false),
                    DocPricingUnitPrice = table.Column<decimal>(nullable: false),
                    OverridePriceList = table.Column<bool>(nullable: false),
                    QtyOption = table.Column<string>(maxLength: 10, nullable: false),
                    OrigComment = table.Column<string>(nullable: false),
                    DueDate = table.Column<DateTime>(type: "date", nullable: true),
                    ContractID = table.Column<string>(maxLength: 50, nullable: false),
                    LinkToContract = table.Column<bool>(nullable: false),
                    SelCurrPricingUnitPrice = table.Column<decimal>(nullable: false),
                    ChangedBy = table.Column<string>(maxLength: 75, nullable: false),
                    ChangeDate = table.Column<DateTime>(nullable: true),
                    PCLinkRemoved = table.Column<bool>(nullable: false),
                    TaxCatID = table.Column<string>(maxLength: 10, nullable: false),
                    NoTaxRecalc = table.Column<bool>(nullable: false),
                    InUnitCost = table.Column<decimal>(nullable: false),
                    DocInUnitCost = table.Column<decimal>(nullable: false),
                    InAdvancePayBal = table.Column<decimal>(nullable: false),
                    DocInAdvancePayBal = table.Column<decimal>(nullable: false),
                    InContractUnitCost = table.Column<decimal>(nullable: false),
                    DocInContractUnitCost = table.Column<decimal>(nullable: false),
                    DocExtCost = table.Column<decimal>(nullable: false),
                    ExtCost = table.Column<decimal>(nullable: false),
                    DocMiscCost = table.Column<decimal>(nullable: false),
                    MiscCost = table.Column<decimal>(nullable: false),
                    TenantId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PODetail", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "POHeader",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    Company = table.Column<string>(maxLength: 8, nullable: true),
                    OpenOrder = table.Column<bool>(nullable: false),
                    VoidOrder = table.Column<bool>(nullable: false),
                    PONum = table.Column<int>(nullable: false),
                    EntryPerson = table.Column<string>(maxLength: 75, nullable: false),
                    OrderDate = table.Column<DateTime>(type: "date", nullable: true),
                    FOB = table.Column<string>(maxLength: 15, nullable: false),
                    ShipViaCode = table.Column<string>(maxLength: 4, nullable: false),
                    TermsCode = table.Column<string>(maxLength: 4, nullable: false),
                    ShipName = table.Column<string>(maxLength: 50, nullable: false),
                    ShipAddress = table.Column<string>(maxLength: 50, nullable: false),
                    ShipCity = table.Column<string>(maxLength: 50, nullable: false),
                    ShipState = table.Column<string>(maxLength: 50, nullable: false),
                    ShipZIP = table.Column<string>(maxLength: 10, nullable: false),
                    ShipCountry = table.Column<string>(maxLength: 50, nullable: false),
                    BuyerID = table.Column<string>(maxLength: 8, nullable: false),
                    FreightPP = table.Column<bool>(nullable: false),
                    PrcConNum = table.Column<int>(nullable: false),
                    VendorNum = table.Column<int>(nullable: false),
                    PurPoint = table.Column<string>(maxLength: 4, nullable: false),
                    CommentText = table.Column<string>(nullable: false),
                    OrderHeld = table.Column<bool>(nullable: false),
                    ShipToConName = table.Column<string>(maxLength: 50, nullable: false),
                    ReadyToPrint = table.Column<bool>(nullable: false),
                    PrintAs = table.Column<string>(maxLength: 2, nullable: false),
                    CurrencyCode = table.Column<string>(maxLength: 4, nullable: false),
                    ExchangeRate = table.Column<decimal>(nullable: false),
                    LockRate = table.Column<bool>(nullable: false),
                    ShipCountryNum = table.Column<int>(nullable: false),
                    LogChanges = table.Column<bool>(nullable: false),
                    ApprovedDate = table.Column<DateTime>(type: "date", nullable: true),
                    ApprovedBy = table.Column<string>(maxLength: 75, nullable: false),
                    Approve = table.Column<bool>(nullable: false),
                    ApprovalStatus = table.Column<string>(maxLength: 2, nullable: false),
                    ApprovedAmount = table.Column<decimal>(nullable: false),
                    PostToWeb = table.Column<bool>(nullable: false),
                    PostDate = table.Column<DateTime>(type: "date", nullable: true),
                    VendorRefNum = table.Column<string>(maxLength: 30, nullable: false),
                    ConfirmReq = table.Column<bool>(nullable: false),
                    Confirmed = table.Column<bool>(nullable: false),
                    ConfirmVia = table.Column<string>(maxLength: 8, nullable: false),
                    OrderNum = table.Column<int>(nullable: false),
                    LegalNumber = table.Column<string>(maxLength: 30, nullable: false),
                    Linked = table.Column<bool>(nullable: false),
                    ExtCompany = table.Column<string>(maxLength: 8, nullable: false),
                    XRefPONum = table.Column<string>(maxLength: 50, nullable: false),
                    ConsolidatedPO = table.Column<bool>(nullable: false),
                    GlbCompany = table.Column<string>(maxLength: 8, nullable: false),
                    ContractOrder = table.Column<bool>(nullable: false),
                    ContractStartDate = table.Column<DateTime>(type: "date", nullable: true),
                    ContractEndDate = table.Column<DateTime>(type: "date", nullable: true),
                    PrintHeaderAddress = table.Column<bool>(nullable: false),
                    RateGrpCode = table.Column<string>(maxLength: 12, nullable: false),
                    POType = table.Column<string>(maxLength: 3, nullable: false),
                    APLOCID = table.Column<string>(maxLength: 20, nullable: false),
                    TranDocTypeID = table.Column<string>(maxLength: 12, nullable: false),
                    AutoPrintReady = table.Column<bool>(nullable: false),
                    ICPOLocked = table.Column<bool>(nullable: false),
                    DueDate = table.Column<DateTime>(type: "date", nullable: true),
                    PromiseDate = table.Column<DateTime>(type: "date", nullable: true),
                    ChangedBy = table.Column<string>(maxLength: 75, nullable: false),
                    ChangeDate = table.Column<DateTime>(nullable: true),
                    POTaxReadyToProcess = table.Column<bool>(nullable: false),
                    TaxRegionCode = table.Column<string>(maxLength: 4, nullable: false),
                    TaxPoint = table.Column<DateTime>(type: "date", nullable: true),
                    TaxRateDate = table.Column<DateTime>(type: "date", nullable: true),
                    TotalTax = table.Column<decimal>(nullable: false),
                    DocTotalTax = table.Column<decimal>(nullable: false),
                    TotalWhTax = table.Column<decimal>(nullable: false),
                    DocTotalWhTax = table.Column<decimal>(nullable: false),
                    TotalSATax = table.Column<decimal>(nullable: false),
                    DocTotalSATax = table.Column<decimal>(nullable: false),
                    InPrice = table.Column<bool>(nullable: false),
                    HdrTaxNoUpdt = table.Column<bool>(nullable: false),
                    TaxRateGrpCode = table.Column<string>(maxLength: 12, nullable: false),
                    TotalDedTax = table.Column<decimal>(nullable: false),
                    DocTotalDedTax = table.Column<decimal>(nullable: false),
                    TotalCharges = table.Column<decimal>(nullable: false),
                    TotalMiscCharges = table.Column<decimal>(nullable: false),
                    TotalOrder = table.Column<decimal>(nullable: false),
                    DocTotalCharges = table.Column<decimal>(nullable: false),
                    DocTotalMisc = table.Column<decimal>(nullable: false),
                    DocTotalOrder = table.Column<decimal>(nullable: false),
                    TenantId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_POHeader", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "PORel",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    Company = table.Column<string>(maxLength: 8, nullable: false),
                    OpenRelease = table.Column<bool>(nullable: false),
                    VoidRelease = table.Column<bool>(nullable: false),
                    PONum = table.Column<int>(nullable: false),
                    POLine = table.Column<int>(nullable: false),
                    PORelNum = table.Column<int>(nullable: false),
                    DueDate = table.Column<DateTime>(type: "date", nullable: true),
                    XRelQty = table.Column<decimal>(nullable: false),
                    PurchasingFactor = table.Column<decimal>(nullable: false),
                    RelQty = table.Column<decimal>(nullable: false),
                    JobNum = table.Column<string>(maxLength: 14, nullable: false),
                    AssemblySeq = table.Column<int>(nullable: false),
                    JobSeqType = table.Column<string>(maxLength: 2, nullable: false),
                    JobSeq = table.Column<int>(nullable: false),
                    WarehouseCode = table.Column<string>(maxLength: 8, nullable: false),
                    ReceivedQty = table.Column<decimal>(nullable: false),
                    ExpOverride = table.Column<bool>(nullable: false),
                    ReqNum = table.Column<int>(nullable: false),
                    ReqLine = table.Column<int>(nullable: false),
                    Plant = table.Column<string>(maxLength: 8, nullable: false),
                    PromiseDt = table.Column<DateTime>(type: "date", nullable: true),
                    ProjectID = table.Column<string>(maxLength: 25, nullable: false),
                    Confirmed = table.Column<bool>(nullable: false),
                    ConfirmVia = table.Column<string>(maxLength: 8, nullable: false),
                    ReqChgDate = table.Column<DateTime>(type: "date", nullable: true),
                    ReqChgQty = table.Column<decimal>(nullable: false),
                    LockRel = table.Column<string>(maxLength: 8, nullable: false),
                    RefDisplayAccount = table.Column<string>(maxLength: 65, nullable: false),
                    RefType = table.Column<string>(maxLength: 8, nullable: false),
                    RefCode = table.Column<string>(maxLength: 8, nullable: false),
                    RefCodeDesc = table.Column<string>(maxLength: 30, nullable: false),
                    OrderNum = table.Column<int>(nullable: false),
                    OrderLine = table.Column<int>(nullable: false),
                    OrderRelNum = table.Column<int>(nullable: false),
                    Linked = table.Column<bool>(nullable: false),
                    ExtCompany = table.Column<string>(maxLength: 8, nullable: false),
                    ShippedQty = table.Column<decimal>(nullable: false),
                    TranType = table.Column<string>(maxLength: 7, nullable: false),
                    GlbCompany = table.Column<string>(maxLength: 8, nullable: false),
                    GlbPlant = table.Column<string>(maxLength: 8, nullable: false),
                    GlbWarehouse = table.Column<string>(maxLength: 8, nullable: false),
                    GlbCreateJobMtl = table.Column<bool>(nullable: false),
                    ShippedDate = table.Column<DateTime>(type: "date", nullable: true),
                    ContainerID = table.Column<int>(nullable: false),
                    PurchasingFactorDirection = table.Column<string>(maxLength: 1, nullable: false),
                    PreviousDueDate = table.Column<DateTime>(type: "date", nullable: true),
                    BaseQty = table.Column<decimal>(nullable: false),
                    BaseUOM = table.Column<string>(maxLength: 6, nullable: false),
                    BTOOrderNum = table.Column<int>(nullable: false),
                    BTOOrderLine = table.Column<int>(nullable: false),
                    BTOOrderRelNum = table.Column<int>(nullable: false),
                    DropShip = table.Column<bool>(nullable: false),
                    ShipToNum = table.Column<string>(maxLength: 14, nullable: false),
                    SoldToNum = table.Column<int>(nullable: false),
                    SMIRcvdQty = table.Column<decimal>(nullable: false),
                    ShpConNum = table.Column<int>(nullable: false),
                    ShipToCustNum = table.Column<int>(nullable: false),
                    MangCustNum = table.Column<int>(nullable: false),
                    UseOTS = table.Column<bool>(nullable: false),
                    OTSName = table.Column<string>(maxLength: 50, nullable: false),
                    OTSAddress = table.Column<string>(maxLength: 50, nullable: false),
                    OTSCity = table.Column<string>(maxLength: 50, nullable: false),
                    OTSState = table.Column<string>(maxLength: 50, nullable: false),
                    OTSZIP = table.Column<string>(maxLength: 10, nullable: false),
                    OTSResaleID = table.Column<string>(maxLength: 20, nullable: false),
                    OTSContact = table.Column<string>(maxLength: 50, nullable: false),
                    OTSFaxNum = table.Column<string>(maxLength: 20, nullable: false),
                    OTSPhoneNum = table.Column<string>(maxLength: 20, nullable: false),
                    OTSCountryNum = table.Column<int>(nullable: false),
                    ComplianceMsg = table.Column<string>(nullable: false),
                    PORelOpen = table.Column<bool>(nullable: false),
                    Mapping = table.Column<bool>(nullable: false),
                    PhaseID = table.Column<string>(maxLength: 12, nullable: false),
                    WBSPhaseID = table.Column<string>(maxLength: 12, nullable: false),
                    IsMultiRel = table.Column<bool>(nullable: false),
                    SMIRemQty = table.Column<decimal>(nullable: false),
                    LockQty = table.Column<bool>(nullable: false),
                    LockDate = table.Column<bool>(nullable: false),
                    DueDateChanged = table.Column<bool>(nullable: false),
                    ContractID = table.Column<string>(maxLength: 50, nullable: false),
                    LinkToContract = table.Column<bool>(nullable: false),
                    Status = table.Column<string>(maxLength: 1, nullable: false),
                    ArrivedQty = table.Column<decimal>(nullable: false),
                    InvoicedQty = table.Column<decimal>(nullable: false),
                    NeedByDate = table.Column<DateTime>(type: "date", nullable: true),
                    LockNeedByDate = table.Column<bool>(nullable: false),
                    InspectionQty = table.Column<decimal>(nullable: false),
                    FailedQty = table.Column<decimal>(nullable: false),
                    PassedQty = table.Column<decimal>(nullable: false),
                    ProjProcessed = table.Column<bool>(nullable: false),
                    DeliverTo = table.Column<string>(maxLength: 150, nullable: false),
                    Taxable = table.Column<bool>(nullable: false),
                    TaxExempt = table.Column<string>(maxLength: 20, nullable: false),
                    NoTaxRecalc = table.Column<bool>(nullable: false),
                    TenantId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PORel", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "RcvDtl",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    Company = table.Column<string>(maxLength: 8, nullable: true),
                    VendorNum = table.Column<int>(nullable: false),
                    PurPoint = table.Column<string>(maxLength: 4, nullable: true),
                    PackSlip = table.Column<string>(maxLength: 20, nullable: true),
                    PackLine = table.Column<int>(nullable: false),
                    Invoiced = table.Column<bool>(nullable: false),
                    InvoiceNum = table.Column<string>(maxLength: 20, nullable: false),
                    InvoiceLine = table.Column<int>(nullable: false),
                    PartNum = table.Column<string>(maxLength: 50, nullable: false),
                    WareHouseCode = table.Column<string>(maxLength: 8, nullable: false),
                    BinNum = table.Column<string>(maxLength: 10, nullable: false),
                    OurQty = table.Column<decimal>(nullable: false),
                    IUM = table.Column<string>(maxLength: 6, nullable: false),
                    OurUnitCost = table.Column<decimal>(nullable: false),
                    JobNum = table.Column<string>(maxLength: 14, nullable: false),
                    AssemblySeq = table.Column<int>(nullable: false),
                    JobSeqType = table.Column<string>(maxLength: 2, nullable: false),
                    JobSeq = table.Column<int>(nullable: false),
                    PONum = table.Column<int>(nullable: false),
                    POLine = table.Column<int>(nullable: false),
                    PORelNum = table.Column<int>(nullable: false),
                    TranReference = table.Column<string>(maxLength: 30, nullable: false),
                    PartDescription = table.Column<string>(nullable: false),
                    RevisionNum = table.Column<string>(maxLength: 12, nullable: false),
                    VendorQty = table.Column<decimal>(nullable: false),
                    VendorUnitCost = table.Column<decimal>(nullable: false),
                    ReceiptType = table.Column<string>(maxLength: 2, nullable: false),
                    ReceivedTo = table.Column<string>(maxLength: 7, nullable: false),
                    ReceivedComplete = table.Column<bool>(nullable: false),
                    IssuedComplete = table.Column<bool>(nullable: false),
                    PUM = table.Column<string>(maxLength: 6, nullable: false),
                    VenPartNum = table.Column<string>(maxLength: 50, nullable: false),
                    CostPerCode = table.Column<string>(maxLength: 2, nullable: false),
                    LotNum = table.Column<string>(maxLength: 30, nullable: false),
                    NumLabels = table.Column<int>(nullable: false),
                    DimCode = table.Column<string>(maxLength: 6, nullable: false),
                    DUM = table.Column<string>(maxLength: 6, nullable: false),
                    DimConvFactor = table.Column<decimal>(nullable: false),
                    InspectionReq = table.Column<bool>(nullable: false),
                    InspectionPending = table.Column<bool>(nullable: false),
                    InspectorID = table.Column<string>(maxLength: 8, nullable: false),
                    InspectedBy = table.Column<string>(maxLength: 75, nullable: false),
                    InspectedDate = table.Column<DateTime>(type: "date", nullable: true),
                    InspectedTime = table.Column<int>(nullable: false),
                    PassedQty = table.Column<decimal>(nullable: false),
                    FailedQty = table.Column<decimal>(nullable: false),
                    ReceiptDate = table.Column<DateTime>(type: "date", nullable: true),
                    ReasonCode = table.Column<string>(maxLength: 8, nullable: false),
                    TotCostVariance = table.Column<decimal>(nullable: false),
                    Weight = table.Column<decimal>(nullable: false),
                    WeightUOM = table.Column<string>(maxLength: 6, nullable: false),
                    NonConformnce = table.Column<bool>(nullable: false),
                    MtlBurRate = table.Column<decimal>(nullable: false),
                    OurMtlBurUnitCost = table.Column<decimal>(nullable: false),
                    RefType = table.Column<string>(maxLength: 8, nullable: false),
                    RefCode = table.Column<string>(maxLength: 8, nullable: false),
                    PurchCode = table.Column<string>(maxLength: 8, nullable: false),
                    LCFlag = table.Column<bool>(nullable: false),
                    GlbCompany = table.Column<string>(maxLength: 8, nullable: false),
                    GlbVendorNum = table.Column<int>(nullable: false),
                    GlbPurPoint = table.Column<string>(maxLength: 4, nullable: false),
                    GlbPackSlip = table.Column<string>(maxLength: 20, nullable: false),
                    GlbPackLine = table.Column<int>(nullable: false),
                    DocUnitCost = table.Column<decimal>(nullable: false),
                    ContainerID = table.Column<int>(nullable: false),
                    Volume = table.Column<decimal>(nullable: false),
                    RptUnitCost = table.Column<decimal>(nullable: false),
                    OrderNum = table.Column<int>(nullable: false),
                    OrderLine = table.Column<int>(nullable: false),
                    OrderRelNum = table.Column<int>(nullable: false),
                    OrigCountryNum = table.Column<int>(nullable: false),
                    UpliftPercent = table.Column<decimal>(nullable: false),
                    LCDutyAmt = table.Column<decimal>(nullable: false),
                    LCIndCost = table.Column<decimal>(nullable: false),
                    POTransValue = table.Column<decimal>(nullable: false),
                    ExtTransValue = table.Column<decimal>(nullable: false),
                    Received = table.Column<bool>(nullable: false),
                    CommodityCode = table.Column<string>(maxLength: 12, nullable: false),
                    POType = table.Column<string>(maxLength: 3, nullable: false),
                    AutoReceipt = table.Column<bool>(nullable: false),
                    VolumeUOM = table.Column<string>(maxLength: 6, nullable: false),
                    ArrivedDate = table.Column<DateTime>(type: "date", nullable: true),
                    LCSpecLineDutyAmt = table.Column<decimal>(nullable: false),
                    AppliedRcptLCAmt = table.Column<decimal>(nullable: false),
                    LCUpliftIndCost = table.Column<decimal>(nullable: false),
                    LCAmt = table.Column<decimal>(nullable: false),
                    AppliedLCVariance = table.Column<decimal>(nullable: false),
                    LCMtlBurUnitCost = table.Column<decimal>(nullable: false),
                    DocVendorUnitCost = table.Column<decimal>(nullable: false),
                    RptVendorUnitCost = table.Column<decimal>(nullable: false),
                    NotCompliant = table.Column<bool>(nullable: false),
                    ComplianceMsg = table.Column<string>(nullable: false),
                    MangCustNum = table.Column<int>(nullable: false),
                    LegalNumber = table.Column<string>(maxLength: 30, nullable: false),
                    ICPackNum = table.Column<int>(nullable: false),
                    ShipRcv = table.Column<string>(maxLength: 20, nullable: false),
                    ImportNum = table.Column<string>(maxLength: 30, nullable: false),
                    ImportedFrom = table.Column<int>(nullable: false),
                    ImportedFromDesc = table.Column<string>(maxLength: 40, nullable: false),
                    GrossWeight = table.Column<decimal>(nullable: false),
                    GrossWeightUOM = table.Column<string>(maxLength: 6, nullable: false),
                    QtyOption = table.Column<string>(maxLength: 10, nullable: false),
                    ConvOverride = table.Column<bool>(nullable: false),
                    ContractID = table.Column<string>(maxLength: 50, nullable: false),
                    SMITransNum = table.Column<int>(nullable: false),
                    PCID = table.Column<string>(maxLength: 12, nullable: false),
                    ChangedBy = table.Column<string>(maxLength: 75, nullable: false),
                    ChangeDate = table.Column<DateTime>(nullable: true),
                    Delivered = table.Column<bool>(nullable: false),
                    DeliveredComments = table.Column<string>(maxLength: 500, nullable: false),
                    InOurCost = table.Column<decimal>(nullable: false),
                    DocInUnitCost = table.Column<decimal>(nullable: false),
                    RptInUnitCost = table.Column<decimal>(nullable: false),
                    InVendorUnitCost = table.Column<decimal>(nullable: false),
                    DocInVendorUnitCost = table.Column<decimal>(nullable: false),
                    RptInVendorUnitCost = table.Column<decimal>(nullable: false),
                    SupplierUnInvcReceiptQty = table.Column<decimal>(nullable: false),
                    OurUnInvcReceiptQty = table.Column<decimal>(nullable: false),
                    TenantId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_RcvDtl", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "RcvHead",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    Company = table.Column<string>(maxLength: 8, nullable: false),
                    VendorNum = table.Column<int>(nullable: false),
                    PurPoint = table.Column<string>(maxLength: 4, nullable: false),
                    PackSlip = table.Column<string>(maxLength: 20, nullable: false),
                    ReceiptDate = table.Column<DateTime>(type: "date", nullable: true),
                    EntryPerson = table.Column<string>(maxLength: 75, nullable: false),
                    SaveForInvoicing = table.Column<bool>(nullable: false),
                    Invoiced = table.Column<bool>(nullable: false),
                    ReceiptComment = table.Column<string>(nullable: false),
                    ReceivePerson = table.Column<string>(maxLength: 75, nullable: false),
                    ShipViaCode = table.Column<string>(maxLength: 4, nullable: false),
                    EntryDate = table.Column<DateTime>(type: "date", nullable: true),
                    Plant = table.Column<string>(maxLength: 8, nullable: false),
                    PONum = table.Column<int>(nullable: false),
                    LCReference = table.Column<string>(nullable: false),
                    LCComment = table.Column<string>(nullable: false),
                    LandedCost = table.Column<decimal>(nullable: false),
                    LegalNumber = table.Column<string>(maxLength: 30, nullable: false),
                    LCVariance = table.Column<decimal>(nullable: false),
                    ICLinked = table.Column<bool>(nullable: false),
                    GlbCompany = table.Column<string>(maxLength: 8, nullable: false),
                    GlbVendorNum = table.Column<int>(nullable: false),
                    GlbPurPoint = table.Column<string>(maxLength: 4, nullable: false),
                    GlbPackSlip = table.Column<string>(maxLength: 20, nullable: false),
                    ContainerID = table.Column<int>(nullable: false),
                    Weight = table.Column<decimal>(nullable: false),
                    LCDisburseMethod = table.Column<string>(maxLength: 8, nullable: false),
                    AutoReceipt = table.Column<bool>(nullable: false),
                    AutoTranType = table.Column<string>(maxLength: 7, nullable: false),
                    POType = table.Column<string>(maxLength: 3, nullable: false),
                    AutoTranID = table.Column<int>(nullable: false),
                    WeightUOM = table.Column<string>(maxLength: 6, nullable: false),
                    UpliftPercent = table.Column<decimal>(nullable: false),
                    SpecDutyAmt = table.Column<decimal>(nullable: false),
                    AppliedLCAmt = table.Column<decimal>(nullable: false),
                    LCDutyAmt = table.Column<decimal>(nullable: false),
                    LCIndCost = table.Column<decimal>(nullable: false),
                    ApplyToLC = table.Column<bool>(nullable: false),
                    Received = table.Column<bool>(nullable: false),
                    ArrivedDate = table.Column<DateTime>(type: "date", nullable: true),
                    AppliedRcptLCAmt = table.Column<decimal>(nullable: false),
                    LCUpliftIndCost = table.Column<decimal>(nullable: false),
                    AppliedLCVariance = table.Column<decimal>(nullable: false),
                    TranDocTypeID = table.Column<string>(maxLength: 12, nullable: false),
                    ImportNum = table.Column<string>(maxLength: 30, nullable: false),
                    ImportedFrom = table.Column<int>(nullable: false),
                    ImportedFromDesc = table.Column<string>(maxLength: 40, nullable: false),
                    GrossWeight = table.Column<decimal>(nullable: false),
                    GrossWeightUOM = table.Column<string>(maxLength: 6, nullable: false),
                    ChangedBy = table.Column<string>(maxLength: 75, nullable: false),
                    ChangeDate = table.Column<DateTime>(nullable: true),
                    TenantId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_RcvHead", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "RcvMisc",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    Company = table.Column<string>(maxLength: 8, nullable: true),
                    VendorNum = table.Column<int>(nullable: false),
                    PurPoint = table.Column<string>(maxLength: 4, nullable: true),
                    PackSlip = table.Column<string>(maxLength: 20, nullable: true),
                    MiscSeq = table.Column<int>(nullable: false),
                    MiscCode = table.Column<string>(maxLength: 4, nullable: false),
                    ExcludeFromLC = table.Column<bool>(nullable: false),
                    IncTransValue = table.Column<bool>(nullable: false),
                    LCDisburseMethod = table.Column<string>(maxLength: 8, nullable: false),
                    ActualAmt = table.Column<decimal>(nullable: false),
                    DocActualAmt = table.Column<decimal>(nullable: false),
                    CurrencyCode = table.Column<string>(maxLength: 4, nullable: false),
                    LockRate = table.Column<bool>(nullable: false),
                    CommentText = table.Column<string>(nullable: false),
                    RptActualAmt = table.Column<decimal>(nullable: false),
                    ApplyDate = table.Column<DateTime>(type: "date", nullable: true),
                    RateGrpCode = table.Column<string>(maxLength: 12, nullable: false),
                    InvoiceNum = table.Column<string>(maxLength: 20, nullable: false),
                    InvoiceLine = table.Column<int>(nullable: false),
                    MscNum = table.Column<int>(nullable: false),
                    Percentage = table.Column<decimal>(nullable: false),
                    Type = table.Column<string>(maxLength: 1, nullable: false),
                    APInvVendorNum = table.Column<int>(nullable: false),
                    PackLine = table.Column<int>(nullable: false),
                    TenantId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_RcvMisc", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Resource",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    Company = table.Column<string>(maxLength: 8, nullable: true),
                    ResourceGrpID = table.Column<string>(maxLength: 8, nullable: false),
                    ResourceID = table.Column<string>(maxLength: 12, nullable: true),
                    Description = table.Column<string>(maxLength: 30, nullable: false),
                    Inactive = table.Column<bool>(nullable: false),
                    Finite = table.Column<bool>(nullable: false),
                    AllowManualOverride = table.Column<bool>(nullable: false),
                    NextMaintDate = table.Column<DateTime>(type: "date", nullable: true),
                    OutputWhse = table.Column<string>(maxLength: 8, nullable: false),
                    OutputBinNum = table.Column<string>(maxLength: 10, nullable: false),
                    BackflushWhse = table.Column<string>(maxLength: 8, nullable: false),
                    BackflushBinNum = table.Column<string>(maxLength: 10, nullable: false),
                    InputWhse = table.Column<string>(maxLength: 8, nullable: false),
                    InputBinNum = table.Column<string>(maxLength: 10, nullable: false),
                    ResourceType = table.Column<string>(maxLength: 8, nullable: false),
                    ConcurrentCapacity = table.Column<decimal>(nullable: false),
                    TrackProdQty = table.Column<bool>(nullable: false),
                    LinkedPart = table.Column<string>(maxLength: 50, nullable: false),
                    AssetNum = table.Column<string>(maxLength: 20, nullable: false),
                    ProdBurRate = table.Column<decimal>(nullable: false),
                    ProdLabRate = table.Column<decimal>(nullable: false),
                    SetupBurRate = table.Column<decimal>(nullable: false),
                    SetupLabRate = table.Column<decimal>(nullable: false),
                    QProdBurRate = table.Column<decimal>(nullable: false),
                    QProdLabRate = table.Column<decimal>(nullable: false),
                    QSetupBurRate = table.Column<decimal>(nullable: false),
                    QSetupLabRate = table.Column<decimal>(nullable: false),
                    QBurdenType = table.Column<string>(maxLength: 8, nullable: false),
                    GetDefaultBurdenFromGroup = table.Column<bool>(nullable: false),
                    VendorNum = table.Column<int>(nullable: false),
                    BurdenType = table.Column<string>(maxLength: 8, nullable: false),
                    CalendarID = table.Column<string>(maxLength: 8, nullable: false),
                    MoveHours = table.Column<decimal>(nullable: false),
                    QueHours = table.Column<decimal>(nullable: false),
                    GetDefaultMQFromGroup = table.Column<bool>(nullable: false),
                    InformOverload = table.Column<bool>(nullable: false),
                    MinOverloadPerc = table.Column<decimal>(nullable: false),
                    OpCode = table.Column<string>(maxLength: 8, nullable: false),
                    OpStdID = table.Column<string>(maxLength: 5, nullable: false),
                    GetDefaultLaborFromGroup = table.Column<bool>(nullable: false),
                    FiniteHorizon = table.Column<int>(nullable: false),
                    AutoMove = table.Column<bool>(nullable: false),
                    SplitOperations = table.Column<bool>(nullable: false),
                    DailyProdQty = table.Column<decimal>(nullable: false),
                    BillLaborRate = table.Column<decimal>(nullable: false),
                    DailyProdRate = table.Column<decimal>(nullable: false),
                    GetDefaultWhseFromGroup = table.Column<bool>(nullable: false),
                    Location = table.Column<bool>(nullable: false),
                    InspPlanPartNum = table.Column<string>(maxLength: 50, nullable: false),
                    SpecID = table.Column<string>(maxLength: 20, nullable: false),
                    LastCalDate = table.Column<DateTime>(type: "date", nullable: true),
                    InspPlanRevNum = table.Column<string>(maxLength: 12, nullable: false),
                    SpecRevNum = table.Column<string>(maxLength: 12, nullable: false),
                    EquipID = table.Column<string>(maxLength: 20, nullable: false),
                    URL = table.Column<string>(maxLength: 500, nullable: false),
                    JDFDevice = table.Column<string>(maxLength: 50, nullable: false),
                    ExternalMES = table.Column<bool>(nullable: false),
                    NumCavs = table.Column<decimal>(nullable: false),
                    RunnerWt = table.Column<decimal>(nullable: false),
                    SetupTime = table.Column<int>(nullable: false),
                    TearDownTime = table.Column<int>(nullable: false),
                    MiscInfo1 = table.Column<string>(maxLength: 30, nullable: false),
                    MiscInfo2 = table.Column<string>(maxLength: 30, nullable: false),
                    Brand = table.Column<string>(maxLength: 30, nullable: false),
                    LocID = table.Column<string>(maxLength: 20, nullable: false),
                    PmMapNo = table.Column<int>(nullable: false),
                    SetupURL = table.Column<string>(maxLength: 256, nullable: false),
                    MobileResource = table.Column<bool>(nullable: false),
                    TenantId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Resource", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "ResourceGroup",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    Company = table.Column<string>(maxLength: 8, nullable: true),
                    Plant = table.Column<string>(maxLength: 8, nullable: false),
                    ResourceGrpID = table.Column<string>(maxLength: 8, nullable: true),
                    Description = table.Column<string>(maxLength: 30, nullable: false),
                    CalendarID = table.Column<string>(maxLength: 8, nullable: false),
                    Inactive = table.Column<bool>(nullable: false),
                    AllowManualOverride = table.Column<bool>(nullable: false),
                    FiniteHorizon = table.Column<int>(nullable: false),
                    NumberOfMachines = table.Column<int>(nullable: false),
                    SchMachine = table.Column<int>(nullable: false),
                    BurdenType = table.Column<string>(maxLength: 8, nullable: false),
                    MoveHours = table.Column<decimal>(nullable: false),
                    JCDept = table.Column<string>(maxLength: 8, nullable: false),
                    QueHours = table.Column<decimal>(nullable: false),
                    OpCode = table.Column<string>(maxLength: 8, nullable: false),
                    ProdBurRate = table.Column<decimal>(nullable: false),
                    ProdLabRate = table.Column<decimal>(nullable: false),
                    SetupBurRate = table.Column<decimal>(nullable: false),
                    SetupLabRate = table.Column<decimal>(nullable: false),
                    QProdBurRate = table.Column<decimal>(nullable: false),
                    QProdLabRate = table.Column<decimal>(nullable: false),
                    QSetupBurRate = table.Column<decimal>(nullable: false),
                    QSetupLabRate = table.Column<decimal>(nullable: false),
                    SplitBurden = table.Column<bool>(nullable: false),
                    ProdCrewSize = table.Column<decimal>(nullable: false),
                    SetupCrewSize = table.Column<decimal>(nullable: false),
                    OpStdID = table.Column<string>(maxLength: 5, nullable: false),
                    ReloadNum = table.Column<int>(nullable: false),
                    ReloadStatus = table.Column<string>(maxLength: 8, nullable: false),
                    DailyCapacity1 = table.Column<decimal>(nullable: false),
                    DailyCapacity2 = table.Column<decimal>(nullable: false),
                    DailyCapacity3 = table.Column<decimal>(nullable: false),
                    DailyCapacity4 = table.Column<decimal>(nullable: false),
                    DailyCapacity5 = table.Column<decimal>(nullable: false),
                    DailyCapacity6 = table.Column<decimal>(nullable: false),
                    DailyCapacity7 = table.Column<decimal>(nullable: false),
                    QBurdenType = table.Column<string>(maxLength: 8, nullable: false),
                    BurdenEQLabor = table.Column<bool>(nullable: false),
                    SplitOperations = table.Column<bool>(nullable: false),
                    ResourceType = table.Column<string>(maxLength: 8, nullable: false),
                    InputWhse = table.Column<string>(maxLength: 8, nullable: false),
                    InputBinNum = table.Column<string>(maxLength: 10, nullable: false),
                    OutputWhse = table.Column<string>(maxLength: 8, nullable: false),
                    OutputBinNum = table.Column<string>(maxLength: 10, nullable: false),
                    BackflushWhse = table.Column<string>(maxLength: 8, nullable: false),
                    BackflushBinNum = table.Column<string>(maxLength: 10, nullable: false),
                    InformOverload = table.Column<bool>(nullable: false),
                    MinOverloadPerc = table.Column<decimal>(nullable: false),
                    BackflushEmpID = table.Column<string>(maxLength: 8, nullable: false),
                    SubContract = table.Column<bool>(nullable: false),
                    AutoMove = table.Column<bool>(nullable: false),
                    UseEstimates = table.Column<bool>(nullable: false),
                    DailyProdQty = table.Column<decimal>(nullable: false),
                    BillLaborRate = table.Column<decimal>(nullable: false),
                    DailyProdRate = table.Column<decimal>(nullable: false),
                    Location = table.Column<bool>(nullable: false),
                    DistributeLoad = table.Column<bool>(nullable: false),
                    TrkProdAct = table.Column<bool>(nullable: false),
                    SetShopLoad = table.Column<bool>(nullable: false),
                    TAKTValue = table.Column<decimal>(nullable: false),
                    UseCalendarForMove = table.Column<bool>(nullable: false),
                    UseCalendarForQueue = table.Column<bool>(nullable: false),
                    URL = table.Column<string>(maxLength: 500, nullable: false),
                    JDFDevice = table.Column<string>(maxLength: 50, nullable: false),
                    JDFOperation = table.Column<string>(maxLength: 50, nullable: false),
                    TenantId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ResourceGroup", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "ResourceType",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    Company = table.Column<string>(maxLength: 8, nullable: true),
                    ResourceTypeID = table.Column<string>(maxLength: 8, nullable: true),
                    Description = table.Column<string>(maxLength: 30, nullable: false),
                    Inactive = table.Column<bool>(nullable: false),
                    ExternalMESType = table.Column<string>(maxLength: 8, nullable: false),
                    TenantId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ResourceType", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "RMADisp",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    Company = table.Column<string>(maxLength: 8, nullable: true),
                    RMANum = table.Column<int>(nullable: false),
                    RMALine = table.Column<int>(nullable: false),
                    RMAReceipt = table.Column<int>(nullable: false),
                    RMADisp1 = table.Column<int>(nullable: false),
                    DispType = table.Column<string>(maxLength: 7, nullable: false),
                    WareHouseCode = table.Column<string>(maxLength: 8, nullable: false),
                    BinNum = table.Column<string>(maxLength: 10, nullable: false),
                    JobNum = table.Column<string>(maxLength: 14, nullable: false),
                    AssemblySeq = table.Column<int>(nullable: false),
                    MtlSeq = table.Column<int>(nullable: false),
                    DispComment = table.Column<string>(nullable: false),
                    InspectorID = table.Column<string>(maxLength: 8, nullable: false),
                    InspectedBy = table.Column<string>(maxLength: 75, nullable: false),
                    InspectedDate = table.Column<DateTime>(type: "date", nullable: true),
                    InspectedTime = table.Column<int>(nullable: false),
                    NonConfTranID = table.Column<int>(nullable: false),
                    ReasonCode = table.Column<string>(maxLength: 8, nullable: false),
                    DispQty = table.Column<decimal>(nullable: false),
                    DispQtyUOM = table.Column<string>(maxLength: 6, nullable: false),
                    SourceDBRecid = table.Column<string>(maxLength: 20, nullable: false),
                    ChangedBy = table.Column<string>(maxLength: 75, nullable: false),
                    ChangeDate = table.Column<DateTime>(type: "date", nullable: true),
                    ChangeTime = table.Column<int>(nullable: false),
                    RequestMove = table.Column<bool>(nullable: false),
                    TranDocTypeID = table.Column<string>(maxLength: 12, nullable: false),
                    LegalNumber = table.Column<string>(maxLength: 30, nullable: false),
                    OverrideCosts = table.Column<bool>(nullable: false),
                    UseCurrentCost = table.Column<bool>(nullable: false),
                    ToBinNum = table.Column<string>(maxLength: 10, nullable: false),
                    ToWareHouseCode = table.Column<string>(maxLength: 8, nullable: false),
                    SetReassignSNAsm = table.Column<bool>(nullable: false),
                    TenantId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_RMADisp", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "RMADtl",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    Company = table.Column<string>(maxLength: 8, nullable: true),
                    OpenRMA = table.Column<bool>(nullable: false),
                    OpenDtl = table.Column<bool>(nullable: false),
                    RMANum = table.Column<int>(nullable: false),
                    RMALine = table.Column<int>(nullable: false),
                    OrderNum = table.Column<int>(nullable: false),
                    OrderLine = table.Column<int>(nullable: false),
                    ReturnReasonCode = table.Column<string>(maxLength: 8, nullable: false),
                    Note = table.Column<string>(nullable: false),
                    PartNum = table.Column<string>(maxLength: 50, nullable: false),
                    LineDesc = table.Column<string>(nullable: false),
                    RevisionNum = table.Column<string>(maxLength: 12, nullable: false),
                    ReturnQty = table.Column<decimal>(nullable: false),
                    ReturnQtyUOM = table.Column<string>(maxLength: 6, nullable: false),
                    RefInvoiceNum = table.Column<int>(nullable: false),
                    RefInvoiceLine = table.Column<int>(nullable: false),
                    ChangedBy = table.Column<string>(maxLength: 75, nullable: false),
                    ChangeDate = table.Column<DateTime>(type: "date", nullable: true),
                    ChangeTime = table.Column<int>(nullable: false),
                    ShipToNum = table.Column<string>(maxLength: 14, nullable: false),
                    ConNum = table.Column<int>(nullable: false),
                    CustNum = table.Column<int>(nullable: false),
                    OrderRelNum = table.Column<int>(nullable: false),
                    ShipToCustNum = table.Column<int>(nullable: false),
                    InvoiceNum = table.Column<int>(nullable: false),
                    InvoiceLine = table.Column<int>(nullable: false),
                    JobNum = table.Column<string>(maxLength: 14, nullable: false),
                    AssemblySeq = table.Column<int>(nullable: false),
                    MtlSeq = table.Column<int>(nullable: false),
                    ECCComment = table.Column<string>(nullable: false),
                    ECCRMANum = table.Column<string>(maxLength: 10, nullable: false),
                    ECCRMALine = table.Column<int>(nullable: false),
                    TenantId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_RMADtl", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "RMAHead",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    OpenRMA = table.Column<bool>(nullable: false),
                    Company = table.Column<string>(maxLength: 8, nullable: true),
                    RMANum = table.Column<int>(nullable: false),
                    RMADate = table.Column<DateTime>(type: "date", nullable: true),
                    CustNum = table.Column<int>(nullable: false),
                    DebitMemoRef = table.Column<string>(maxLength: 15, nullable: false),
                    CLCallNum = table.Column<string>(maxLength: 16, nullable: false),
                    XRefRMANumber = table.Column<string>(maxLength: 20, nullable: false),
                    HDCaseNum = table.Column<int>(nullable: false),
                    ChangedBy = table.Column<string>(maxLength: 75, nullable: false),
                    ChangeDate = table.Column<DateTime>(type: "date", nullable: true),
                    ChangeTime = table.Column<int>(nullable: false),
                    ShipToNum = table.Column<string>(maxLength: 14, nullable: false),
                    ConNum = table.Column<int>(nullable: false),
                    AutoPrintReady = table.Column<bool>(nullable: false),
                    BTCustNum = table.Column<int>(nullable: false),
                    UseOTS = table.Column<bool>(nullable: false),
                    OTSName = table.Column<string>(maxLength: 50, nullable: false),
                    OTSAddress1 = table.Column<string>(maxLength: 50, nullable: false),
                    OTSAddress2 = table.Column<string>(maxLength: 50, nullable: false),
                    OTSAddress3 = table.Column<string>(maxLength: 50, nullable: false),
                    OTSCity = table.Column<string>(maxLength: 50, nullable: false),
                    OTSState = table.Column<string>(maxLength: 50, nullable: false),
                    OTSZIP = table.Column<string>(maxLength: 10, nullable: false),
                    OTSResaleID = table.Column<string>(maxLength: 20, nullable: false),
                    OTSTaxRegionCode = table.Column<string>(maxLength: 4, nullable: false),
                    OTSContact = table.Column<string>(maxLength: 50, nullable: false),
                    OTSFaxNum = table.Column<string>(maxLength: 20, nullable: false),
                    OTSPhoneNum = table.Column<string>(maxLength: 20, nullable: false),
                    OTSCountryNum = table.Column<int>(nullable: false),
                    ShipToCustNum = table.Column<int>(nullable: false),
                    InvoiceNum = table.Column<int>(nullable: false),
                    TranDocTypeID = table.Column<string>(maxLength: 12, nullable: false),
                    LegalNumber = table.Column<string>(maxLength: 30, nullable: false),
                    RetInvoiceNum = table.Column<string>(maxLength: 20, nullable: false),
                    ECCRMANum = table.Column<string>(maxLength: 10, nullable: false),
                    ECCCustRef = table.Column<string>(maxLength: 255, nullable: false),
                    DocumentPrinted = table.Column<bool>(nullable: false),
                    RMAComment = table.Column<string>(nullable: false),
                    WebComment = table.Column<string>(nullable: false),
                    TenantId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_RMAHead", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "RMARcpt",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    Company = table.Column<string>(maxLength: 8, nullable: true),
                    RMANum = table.Column<int>(nullable: false),
                    RMALine = table.Column<int>(nullable: false),
                    RMAReceipt = table.Column<int>(nullable: false),
                    WareHouseCode = table.Column<string>(maxLength: 8, nullable: false),
                    BinNum = table.Column<string>(maxLength: 10, nullable: false),
                    RcvDate = table.Column<DateTime>(type: "date", nullable: true),
                    LotNum = table.Column<string>(maxLength: 30, nullable: false),
                    OpenReceipt = table.Column<bool>(nullable: false),
                    MtlUnitCost = table.Column<decimal>(nullable: false),
                    LbrUnitCost = table.Column<decimal>(nullable: false),
                    BurUnitCost = table.Column<decimal>(nullable: false),
                    SubUnitCost = table.Column<decimal>(nullable: false),
                    MtlBurUnitCost = table.Column<decimal>(nullable: false),
                    Plant = table.Column<string>(maxLength: 8, nullable: false),
                    MtlMtlUnitCost = table.Column<decimal>(nullable: false),
                    MtlLabUnitCost = table.Column<decimal>(nullable: false),
                    MtlSubUnitCost = table.Column<decimal>(nullable: false),
                    MtlBurdenUnitCost = table.Column<decimal>(nullable: false),
                    MtlMtlBurUnitCost = table.Column<decimal>(nullable: false),
                    ReceivedQty = table.Column<decimal>(nullable: false),
                    DisposedQty = table.Column<decimal>(nullable: false),
                    CostUOM = table.Column<string>(maxLength: 6, nullable: false),
                    ReceivedQtyUOM = table.Column<string>(maxLength: 6, nullable: false),
                    LegalNumber = table.Column<string>(maxLength: 30, nullable: false),
                    ChangedBy = table.Column<string>(maxLength: 75, nullable: false),
                    ChangeDate = table.Column<DateTime>(type: "date", nullable: true),
                    ChangeTime = table.Column<int>(nullable: false),
                    RequestMove = table.Column<bool>(nullable: false),
                    TenantId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_RMARcpt", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "SugPoDtl",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    Company = table.Column<string>(maxLength: 8, nullable: true),
                    SugNum = table.Column<int>(nullable: false),
                    SugType = table.Column<string>(maxLength: 2, nullable: false),
                    BuyerID = table.Column<string>(maxLength: 8, nullable: false),
                    DueDate = table.Column<DateTime>(type: "date", nullable: true),
                    XRelQty = table.Column<decimal>(nullable: false),
                    PurchasingFactor = table.Column<decimal>(nullable: false),
                    RelQty = table.Column<decimal>(nullable: false),
                    JobNum = table.Column<string>(maxLength: 14, nullable: false),
                    AssemblySeq = table.Column<int>(nullable: false),
                    JobSeq = table.Column<int>(nullable: false),
                    WarehouseCode = table.Column<string>(maxLength: 8, nullable: false),
                    FOB = table.Column<string>(maxLength: 15, nullable: false),
                    ShipViaCode = table.Column<string>(maxLength: 4, nullable: false),
                    TermsCode = table.Column<string>(maxLength: 4, nullable: false),
                    VendorNum = table.Column<int>(nullable: false),
                    PurPoint = table.Column<string>(maxLength: 4, nullable: false),
                    LineDesc = table.Column<string>(nullable: false),
                    IUM = table.Column<string>(maxLength: 6, nullable: false),
                    UnitPrice = table.Column<decimal>(nullable: false),
                    DocUnitPrice = table.Column<decimal>(nullable: false),
                    Taxable = table.Column<bool>(nullable: false),
                    PUM = table.Column<string>(maxLength: 6, nullable: false),
                    CostPerCode = table.Column<string>(maxLength: 2, nullable: false),
                    PartNum = table.Column<string>(maxLength: 50, nullable: false),
                    VenPartNum = table.Column<string>(maxLength: 50, nullable: false),
                    CommentText = table.Column<string>(nullable: false),
                    ClassID = table.Column<string>(maxLength: 4, nullable: false),
                    RevisionNum = table.Column<string>(maxLength: 12, nullable: false),
                    VendorID = table.Column<string>(maxLength: 8, nullable: false),
                    Name = table.Column<string>(maxLength: 50, nullable: false),
                    Buy = table.Column<bool>(nullable: false),
                    PONUM = table.Column<int>(nullable: false),
                    POLine = table.Column<int>(nullable: false),
                    OpCode = table.Column<string>(maxLength: 8, nullable: false),
                    OrderByDate = table.Column<DateTime>(type: "date", nullable: true),
                    LeadTime = table.Column<int>(nullable: false),
                    ReqNum = table.Column<int>(nullable: false),
                    ReqLine = table.Column<int>(nullable: false),
                    Plant = table.Column<string>(maxLength: 8, nullable: false),
                    CreateRFQ = table.Column<bool>(nullable: false),
                    SourceRFQ = table.Column<bool>(nullable: false),
                    GlbCompany = table.Column<string>(maxLength: 8, nullable: false),
                    GlbSugNum = table.Column<int>(nullable: false),
                    GlbSuggestion = table.Column<bool>(nullable: false),
                    PurchasingFactorDirection = table.Column<string>(maxLength: 1, nullable: false),
                    RptUnitPrice = table.Column<decimal>(nullable: false),
                    OrderNum = table.Column<int>(nullable: false),
                    OrderLine = table.Column<int>(nullable: false),
                    OrderRelNum = table.Column<int>(nullable: false),
                    DropShip = table.Column<bool>(nullable: false),
                    MfgNum = table.Column<int>(nullable: false),
                    MfgPartNum = table.Column<string>(maxLength: 50, nullable: false),
                    ShipToNum = table.Column<string>(maxLength: 14, nullable: false),
                    SoldToNum = table.Column<int>(nullable: false),
                    ShpConNum = table.Column<int>(nullable: false),
                    ShipToCustNum = table.Column<int>(nullable: false),
                    ComplianceMsg = table.Column<string>(nullable: false),
                    PORelOpen = table.Column<bool>(nullable: false),
                    SugReason = table.Column<string>(maxLength: 2, nullable: false),
                    ABCCode = table.Column<string>(maxLength: 1, nullable: false),
                    Direction = table.Column<string>(maxLength: 50, nullable: false),
                    Per = table.Column<string>(maxLength: 50, nullable: false),
                    ManualFactor = table.Column<bool>(nullable: false),
                    Factor = table.Column<decimal>(nullable: false),
                    PricingQty = table.Column<decimal>(nullable: false),
                    PricingUnitPrice = table.Column<decimal>(nullable: false),
                    UOM = table.Column<string>(maxLength: 6, nullable: false),
                    UrgentPlanning = table.Column<string>(maxLength: 30, nullable: false),
                    MaintainPricingUnits = table.Column<bool>(nullable: false),
                    CurrencyCode = table.Column<string>(maxLength: 4, nullable: false),
                    Review = table.Column<bool>(nullable: false),
                    OverridePriceList = table.Column<bool>(nullable: false),
                    ContractID = table.Column<string>(maxLength: 50, nullable: false),
                    LinkToContract = table.Column<bool>(nullable: false),
                    DemandContractNum = table.Column<int>(nullable: false),
                    DemandHeadSeq = table.Column<int>(nullable: false),
                    DemandDtlSeq = table.Column<int>(nullable: false),
                    DemandScheduleSeq = table.Column<int>(nullable: false),
                    TenantId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SugPoDtl", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Vendor",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    InActive = table.Column<bool>(nullable: false),
                    Company = table.Column<string>(maxLength: 8, nullable: true),
                    VendorID = table.Column<string>(maxLength: 8, nullable: false),
                    Name = table.Column<string>(maxLength: 50, nullable: false),
                    VendorNum = table.Column<int>(nullable: false),
                    Address1 = table.Column<string>(maxLength: 50, nullable: false),
                    Address2 = table.Column<string>(maxLength: 50, nullable: false),
                    Address3 = table.Column<string>(maxLength: 50, nullable: false),
                    City = table.Column<string>(maxLength: 50, nullable: false),
                    State = table.Column<string>(maxLength: 50, nullable: false),
                    ZIP = table.Column<string>(maxLength: 10, nullable: false),
                    Country = table.Column<string>(maxLength: 50, nullable: false),
                    TaxPayerID = table.Column<string>(maxLength: 20, nullable: false),
                    PurPoint = table.Column<string>(maxLength: 4, nullable: false),
                    TermsCode = table.Column<string>(maxLength: 4, nullable: false),
                    GroupCode = table.Column<string>(maxLength: 4, nullable: false),
                    OneCheck = table.Column<bool>(nullable: false),
                    PrintLabels = table.Column<bool>(nullable: false),
                    FaxNum = table.Column<string>(maxLength: 20, nullable: false),
                    PhoneNum = table.Column<string>(maxLength: 20, nullable: false),
                    Comment = table.Column<string>(nullable: false),
                    PayHold = table.Column<bool>(nullable: false),
                    PrimPCon = table.Column<int>(nullable: false),
                    AccountRef = table.Column<string>(maxLength: 20, nullable: false),
                    DefaultFOB = table.Column<string>(maxLength: 15, nullable: false),
                    RcvInspectionReq = table.Column<bool>(nullable: false),
                    CurrencyCode = table.Column<string>(maxLength: 4, nullable: false),
                    TaxRegionCode = table.Column<string>(maxLength: 4, nullable: false),
                    CountryNum = table.Column<int>(nullable: false),
                    LangNameID = table.Column<string>(maxLength: 8, nullable: false),
                    BorderCrossing = table.Column<string>(maxLength: 4, nullable: false),
                    FormatStr = table.Column<string>(maxLength: 50, nullable: false),
                    ElecPayment = table.Column<bool>(nullable: false),
                    PrimaryBankID = table.Column<string>(maxLength: 9, nullable: false),
                    Approved = table.Column<bool>(nullable: false),
                    ICVend = table.Column<bool>(nullable: false),
                    EMailAddress = table.Column<string>(maxLength: 50, nullable: false),
                    WebVendor = table.Column<bool>(nullable: false),
                    VendURL = table.Column<string>(nullable: false),
                    EarlyBuffer = table.Column<int>(nullable: false),
                    LateBuffer = table.Column<int>(nullable: false),
                    OnTimeRating = table.Column<string>(maxLength: 4, nullable: false),
                    QualityRating = table.Column<string>(maxLength: 4, nullable: false),
                    PriceRating = table.Column<string>(maxLength: 4, nullable: false),
                    ServiceRating = table.Column<string>(maxLength: 4, nullable: false),
                    ExternalId = table.Column<string>(maxLength: 40, nullable: false),
                    VendPILimit = table.Column<int>(nullable: false),
                    GlobalVendor = table.Column<bool>(nullable: false),
                    ICTrader = table.Column<bool>(nullable: false),
                    TaxAuthorityCode = table.Column<string>(maxLength: 8, nullable: false),
                    GlobalLock = table.Column<bool>(nullable: false),
                    MinOrderValue = table.Column<decimal>(nullable: false),
                    CalendarID = table.Column<string>(maxLength: 8, nullable: false),
                    EDICode = table.Column<string>(maxLength: 15, nullable: false),
                    ConsolidatedPurchasing = table.Column<bool>(nullable: false),
                    LocalPurchasing = table.Column<bool>(nullable: false),
                    ResDelivery = table.Column<bool>(nullable: false),
                    SatDelivery = table.Column<bool>(nullable: false),
                    SatPickup = table.Column<bool>(nullable: false),
                    Hazmat = table.Column<bool>(nullable: false),
                    DocOnly = table.Column<bool>(nullable: false),
                    RefNotes = table.Column<string>(maxLength: 500, nullable: false),
                    ApplyChrg = table.Column<bool>(nullable: false),
                    ChrgAmount = table.Column<decimal>(nullable: false),
                    COD = table.Column<bool>(nullable: false),
                    CODFreight = table.Column<bool>(nullable: false),
                    CODCheck = table.Column<bool>(nullable: false),
                    CODAmount = table.Column<decimal>(nullable: false),
                    GroundType = table.Column<string>(maxLength: 8, nullable: false),
                    NotifyFlag = table.Column<bool>(nullable: false),
                    NotifyEMail = table.Column<string>(maxLength: 500, nullable: false),
                    DeclaredIns = table.Column<bool>(nullable: false),
                    DeclaredAmt = table.Column<decimal>(nullable: false),
                    ServSignature = table.Column<bool>(nullable: false),
                    ServAlert = table.Column<bool>(nullable: false),
                    ServHomeDel = table.Column<bool>(nullable: false),
                    DeliveryType = table.Column<string>(maxLength: 8, nullable: false),
                    ServDeliveryDate = table.Column<DateTime>(type: "date", nullable: true),
                    ServPhone = table.Column<string>(maxLength: 20, nullable: false),
                    ServInstruct = table.Column<string>(maxLength: 100, nullable: false),
                    ServRelease = table.Column<bool>(nullable: false),
                    ServAuthNum = table.Column<string>(maxLength: 50, nullable: false),
                    ServRef = table.Column<string>(maxLength: 50, nullable: false),
                    CPay = table.Column<bool>(nullable: false),
                    IndividualPackIDs = table.Column<bool>(nullable: false),
                    IntrntlShip = table.Column<bool>(nullable: false),
                    CertOfOrigin = table.Column<bool>(nullable: false),
                    CommercialInvoice = table.Column<bool>(nullable: false),
                    ShipExprtDeclartn = table.Column<bool>(nullable: false),
                    LetterOfInstr = table.Column<bool>(nullable: false),
                    FFID = table.Column<string>(maxLength: 8, nullable: false),
                    FFCompName = table.Column<string>(maxLength: 50, nullable: false),
                    FFContact = table.Column<string>(maxLength: 50, nullable: false),
                    FFAddress1 = table.Column<string>(maxLength: 50, nullable: false),
                    FFAddress2 = table.Column<string>(maxLength: 50, nullable: false),
                    FFAddress3 = table.Column<string>(maxLength: 50, nullable: false),
                    FFCity = table.Column<string>(maxLength: 50, nullable: false),
                    FFState = table.Column<string>(maxLength: 50, nullable: false),
                    FFZip = table.Column<string>(maxLength: 10, nullable: false),
                    FFCountry = table.Column<string>(maxLength: 50, nullable: false),
                    NonStdPkg = table.Column<bool>(nullable: false),
                    DeliveryConf = table.Column<int>(nullable: false),
                    AddlHdlgFlag = table.Column<bool>(nullable: false),
                    UPSQuantumView = table.Column<bool>(nullable: false),
                    UPSQVShipFromName = table.Column<string>(maxLength: 50, nullable: false),
                    UPSQVMemo = table.Column<string>(nullable: false),
                    FFPhoneNum = table.Column<string>(maxLength: 20, nullable: false),
                    FFCountryNum = table.Column<int>(nullable: false),
                    RevChargeMethod = table.Column<string>(maxLength: 8, nullable: false),
                    ManagedCust = table.Column<bool>(nullable: false),
                    ManagedCustID = table.Column<string>(maxLength: 10, nullable: false),
                    ManagedCustNum = table.Column<int>(nullable: false),
                    PMUID = table.Column<int>(nullable: false),
                    HasBank = table.Column<bool>(nullable: false),
                    PmtAcctRef = table.Column<string>(maxLength: 25, nullable: false),
                    APInvoiceITCode = table.Column<string>(maxLength: 12, nullable: false),
                    DebitMemoITCode = table.Column<string>(maxLength: 12, nullable: false),
                    MiscPayITCode = table.Column<string>(maxLength: 12, nullable: false),
                    APInvoiceAdjITCode = table.Column<string>(maxLength: 12, nullable: false),
                    LegalName = table.Column<string>(maxLength: 200, nullable: false),
                    TaxRegReason = table.Column<string>(maxLength: 12, nullable: false),
                    OrgRegCode = table.Column<string>(maxLength: 12, nullable: false),
                    AdvTaxInv = table.Column<bool>(nullable: false),
                    AllowAsAltRemitTo = table.Column<bool>(nullable: false),
                    THBranchID = table.Column<string>(maxLength: 8, nullable: false),
                    ParamCode = table.Column<string>(maxLength: 20, nullable: false),
                    AGAFIPResponsibilityCode = table.Column<string>(maxLength: 4, nullable: false),
                    AGGrossIncomeTaxID = table.Column<string>(maxLength: 20, nullable: false),
                    AGIDDocumentTypeCode = table.Column<string>(maxLength: 4, nullable: false),
                    AGProvinceCode = table.Column<string>(maxLength: 4, nullable: false),
                    AGUseGoodDefaultMark = table.Column<bool>(nullable: false),
                    AGApartment = table.Column<string>(maxLength: 3, nullable: false),
                    AGExtraStreetNumber = table.Column<string>(maxLength: 1, nullable: false),
                    AGFloor = table.Column<string>(maxLength: 3, nullable: false),
                    AGLocationCode = table.Column<string>(maxLength: 5, nullable: false),
                    AGNeighborhood = table.Column<string>(maxLength: 40, nullable: false),
                    AGStreet = table.Column<string>(maxLength: 40, nullable: false),
                    AGStreetNumber = table.Column<string>(maxLength: 8, nullable: false),
                    COOneTimeID = table.Column<string>(maxLength: 20, nullable: false),
                    NoBankingReference = table.Column<bool>(nullable: false),
                    PEGoodsContributor = table.Column<bool>(nullable: false),
                    PEWithholdAgent = table.Column<bool>(nullable: false),
                    PECollectionAgent = table.Column<bool>(nullable: false),
                    PENotFound = table.Column<bool>(nullable: false),
                    PENoAddress = table.Column<bool>(nullable: false),
                    PEIdentityDocType = table.Column<string>(maxLength: 1, nullable: false),
                    COIsOneTimeVend = table.Column<bool>(nullable: false),
                    PEDocumentID = table.Column<string>(maxLength: 60, nullable: false),
                    MaxLateDaysPORel = table.Column<int>(nullable: false),
                    TIN = table.Column<string>(maxLength: 20, nullable: false),
                    TINType = table.Column<string>(maxLength: 2, nullable: false),
                    SecondTINNotice = table.Column<bool>(nullable: false),
                    NameControl = table.Column<string>(maxLength: 4, nullable: false),
                    ShipViaCode = table.Column<string>(maxLength: 4, nullable: false),
                    NonUS = table.Column<bool>(nullable: false),
                    FormTypeID = table.Column<string>(maxLength: 12, nullable: false),
                    INSupplierType = table.Column<string>(maxLength: 30, nullable: false),
                    INCSTNumber = table.Column<string>(maxLength: 25, nullable: false),
                    INPANNumber = table.Column<string>(maxLength: 12, nullable: false),
                    DEOrgType = table.Column<string>(maxLength: 1, nullable: false),
                    PaymentReporting = table.Column<bool>(nullable: false),
                    ExternalPurchasing = table.Column<bool>(nullable: false),
                    MXRetentionCode = table.Column<string>(maxLength: 10, nullable: false),
                    FATCA = table.Column<bool>(nullable: false),
                    AccountNum = table.Column<string>(maxLength: 20, nullable: false),
                    TWGUIRegNum = table.Column<string>(maxLength: 8, nullable: false),
                    MXTARCode = table.Column<string>(maxLength: 10, nullable: false),
                    TenantId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Vendor", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "VendPart",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    Company = table.Column<string>(maxLength: 8, nullable: false),
                    PartNum = table.Column<string>(maxLength: 50, nullable: false),
                    OpCode = table.Column<string>(maxLength: 8, nullable: false),
                    PUM = table.Column<string>(maxLength: 6, nullable: false),
                    EffectiveDate = table.Column<DateTime>(type: "date", nullable: true),
                    VendorNum = table.Column<int>(nullable: false),
                    LeadTime = table.Column<int>(nullable: false),
                    BaseUnitPrice = table.Column<decimal>(nullable: false),
                    VenPartNum = table.Column<string>(maxLength: 50, nullable: false),
                    PriceFormat = table.Column<string>(maxLength: 2, nullable: false),
                    PricePerCode = table.Column<string>(maxLength: 2, nullable: false),
                    MinimumPrice = table.Column<decimal>(nullable: false),
                    ExpirationDate = table.Column<DateTime>(type: "date", nullable: true),
                    Reference = table.Column<string>(maxLength: 30, nullable: false),
                    MiscAmt = table.Column<decimal>(nullable: false),
                    MiscCode = table.Column<string>(maxLength: 4, nullable: false),
                    CommentText = table.Column<string>(nullable: false),
                    DiscountPercent = table.Column<decimal>(nullable: false),
                    PartDescription = table.Column<string>(nullable: false),
                    RFQNum = table.Column<int>(nullable: false),
                    RFQLine = table.Column<int>(nullable: false),
                    CurrencyCode = table.Column<string>(maxLength: 4, nullable: false),
                    OnhandQty = table.Column<decimal>(nullable: false),
                    OnHandDate = table.Column<DateTime>(type: "date", nullable: true),
                    OnHandTime = table.Column<int>(nullable: false),
                    ConNum = table.Column<int>(nullable: false),
                    SupplierResponseReady = table.Column<bool>(nullable: false),
                    DefaultPUM = table.Column<bool>(nullable: false),
                    ConvOperator = table.Column<string>(maxLength: 8, nullable: false),
                    ConvFactor = table.Column<decimal>(nullable: false),
                    ConvOverRide = table.Column<bool>(nullable: false),
                    TenantId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_VendPart", x => x.Id);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "DMRActn");

            migrationBuilder.DropTable(
                name: "DMRCorAct");

            migrationBuilder.DropTable(
                name: "DMRHead");

            migrationBuilder.DropTable(
                name: "JobOpDtl");

            migrationBuilder.DropTable(
                name: "JobOper");

            migrationBuilder.DropTable(
                name: "JobPart");

            migrationBuilder.DropTable(
                name: "OpMaster");

            migrationBuilder.DropTable(
                name: "OrderDtl");

            migrationBuilder.DropTable(
                name: "OrderHed");

            migrationBuilder.DropTable(
                name: "OrderRel");

            migrationBuilder.DropTable(
                name: "PODetail");

            migrationBuilder.DropTable(
                name: "POHeader");

            migrationBuilder.DropTable(
                name: "PORel");

            migrationBuilder.DropTable(
                name: "RcvDtl");

            migrationBuilder.DropTable(
                name: "RcvHead");

            migrationBuilder.DropTable(
                name: "RcvMisc");

            migrationBuilder.DropTable(
                name: "Resource");

            migrationBuilder.DropTable(
                name: "ResourceGroup");

            migrationBuilder.DropTable(
                name: "ResourceType");

            migrationBuilder.DropTable(
                name: "RMADisp");

            migrationBuilder.DropTable(
                name: "RMADtl");

            migrationBuilder.DropTable(
                name: "RMAHead");

            migrationBuilder.DropTable(
                name: "RMARcpt");

            migrationBuilder.DropTable(
                name: "SugPoDtl");

            migrationBuilder.DropTable(
                name: "Vendor");

            migrationBuilder.DropTable(
                name: "VendPart");

            migrationBuilder.AlterColumn<int>(
                name: "TenantId",
                table: "Category",
                nullable: false,
                oldClrType: typeof(int),
                oldNullable: true);
        }
    }
}
